Adding a naive --aspect-ratio option, but the output is not ideal.

Mon, 19 Mar 2012 17:00:52 +0000

author
Andy Buckley <andy@insectnation.org>
date
Mon, 19 Mar 2012 17:00:52 +0000
changeset 180
6e4c9fde492e
parent 179
09b9e3b77261
child 181
c04a4be80445

Adding a naive --aspect-ratio option, but the output is not ideal.

ChangeLog file | annotate | diff | comparison | revisions
slhaplot file | annotate | diff | comparison | revisions
     1.1 --- a/ChangeLog	Wed Mar 07 13:53:21 2012 +0000
     1.2 +++ b/ChangeLog	Mon Mar 19 17:00:52 2012 +0000
     1.3 @@ -1,3 +1,7 @@
     1.4 +2012-03-19  Andy Buckley  <andy.buckley@cern.ch>
     1.5 +
     1.6 +	* Adding a naive --aspect-ratio option, but the output is not ideal.
     1.7 +
     1.8  2012-03-04  Andy Buckley  <andy.buckley@cern.ch>
     1.9  
    1.10  	* Version 1.4.1
     2.1 --- a/slhaplot	Wed Mar 07 13:53:21 2012 +0000
     2.2 +++ b/slhaplot	Mon Mar 19 17:00:52 2012 +0000
     2.3 @@ -22,7 +22,7 @@
     2.4    * Merge labels if shifting fails (cf. "poi" test spectrum file).
     2.5    * Allow use of --outname to specify a list of output base names for multiple inputs.
     2.6    * Use proper distinction between physical, plot-logical, and plot output coords.
     2.7 -  * Allow user control over aspect ratio / geometry.
     2.8 +  * Allow more user control over the output geometry.
     2.9    * Distribute decay arrow start/end positions along mass lines rather than always
    2.10      to/from their centres?
    2.11  """
    2.12 @@ -148,6 +148,9 @@
    2.13                    "'jpg' values respectively. Multiple formats can be created by listing them "
    2.14                    "comma-separated in the format string, e.g. 'png,pdf,tex' (default: %default)",
    2.15                    dest="FORMAT", default="pdf")
    2.16 +parser.add_option("--aspect-ratio", metavar="RATIO", type=float,
    2.17 +                  help="Override the default plot geometry with a custom y/x length ratio (default=%default)",
    2.18 +                  dest="ASPECTRATIO", default=0.7) #0.618
    2.19  parser.add_option("--preamble", metavar="FILE",
    2.20                    help="specify a file to be inserted into LaTeX output as a special preamble",
    2.21                    dest="PREAMBLE", default=None)
    2.22 @@ -445,10 +448,13 @@
    2.23          c = "%"
    2.24  
    2.25      ## Write LaTeX header
    2.26 +    # TODO: Need to sort out the geometry of the page vs. the plot, margin interactions, etc.
    2.27 +    lx = 15.2
    2.28 +    ly = 0.93 * opts.ASPECTRATIO * lx # was 9.8
    2.29      out += "%% http://pypi.python.org/pypi/pyslha\n\n"
    2.30      out += c + "\\documentclass[11pt]{article}\n"
    2.31      out += c + "\\usepackage{amsmath,amssymb}\n"
    2.32 -    out += c + "\\usepackage[margin=0cm,paperwidth=15.2cm,paperheight=9.8cm]{geometry}\n"
    2.33 +    out += c + "\\usepackage[margin=0cm,paperwidth=%.1fcm,paperheight=%.1fcm]{geometry}\n" % (lx, ly)
    2.34      out += c + "\\usepackage{tikz}\n"
    2.35      out += c + "\\pagestyle{empty}\n"
    2.36      out += c + "\n"
    2.37 @@ -483,8 +489,7 @@
    2.38      def scalex(x):
    2.39          return x * XWIDTH/xdiff
    2.40  
    2.41 -    ASPECTRATIO = 0.7 #0.618
    2.42 -    ydiff = ASPECTRATIO * XWIDTH
    2.43 +    ydiff = opts.ASPECTRATIO * XWIDTH
    2.44      ymin = 0.0
    2.45      ymax = ymin + ydiff
    2.46      # TODO: y-height is not fully stable... fix

mercurial