Common pen parameters

From Madagascar
Revision as of 02:13, 26 June 2009 by Nick (talk | contribs) (info from 2005-03-28 blog post)
Jump to navigation Jump to search

Lack of auto-documentation for the common pen parameters is considered a bug. This page attempts to gather information from the mailing list in a structured and editable form. The information below is from a 2009-03-24 exchange of messages between Sergey and Joe on the rsfuser mailing list.

To control the image size, you can use n1= n2= (size in pixels) aspect= (aspect ratio) ppi=(pixels per inch). The default size is 1024x 768.

Because vplot uses a 2-byte representation for integers, it cannot deal with numbers greater than 256*128-1=32767. Feeding into vplot datasets with n1 or n2 greater than this number will result in an error.

Vplot has two output "styles"... size=absolute and size=relative

In size=absolute the output device has a specified size associated with it, and an inch is really an inch.

If size=relative vplot uses the largest 4 wide by 3 tall rectangle that fits within the device screen. That rectangle is 10.24 inches high and 10.24 * 4 / 3 = 13.653 inches wide.

Most devices set "size=relative" as the default. Traditionally hardcopy devices set "size=absolute" the default. After running through vppen by default the file will be "size=absolute" after that (vpstyle=no turns this feature of vppen off).

The user can override the device's default by putting "size=a" or "size=r" on the command line.

xwmax= ywmax= xwmin= ywmin= are generic vplot options which work in any filter. They override the global clip window, which normally would be set at the limits of the device screen. They DON'T reset where the "device screen" is.

These can be useful if you want to chop off an extraneous piece of a plot that you don't want, for example chop off unneeded axis labels on a plot.

My guess is you are wanting to "zoom in" on a particular piece of the vplot plotting area. There are generic vplot options for that, too: you can set "xcenter= ycenter=" and vplot will center that coordinate in the middle of the display. You can then use "scale" to zoom in on that piece to make it bigger.

If you really want to be able to set "bounds of the area to rasterize", we could add those as specific options for gdpen or as generic options to dovplot. But my guess is if the piece you are wanting is small, it doesn't need as many pixels to describe it.

The old SEPlib "vplot2gif" does this by calling vppen to locate the plot on the page (centered at $xcen, $ycen) and see how big it is ($height, $width). It converts the height and width to pixel-size units. It then calls "ppmpen" with the following options:

<bash> ppmpen n2=$height n1=$width ppi=$ppi size=a xcenter=$xcen ycenter=$ycen </bash>

The "size=a" says "an inch is an inch", so that as you shrink the window to just get the part of the plot you are interested in, the plot stays the same size and doesn't shrink as well.

The Madgascar "vplot2gif" does something similar but in Python: <python> run = 'ppmpen break=i n1=%d n2=%d ppi=%d size=a ' \

               'xcenter=%g ycenter=%g %s | ' \
               'ppmquant 256 | ppmtogif > %s' % \


Controlling figure size or aspect ratio

There are three basic parameters: screenratio, screenht, and screenwd. If screenwd is not provided, it is calculated as screenht/screenratio. The defaults are:


For a finer control, you can use xinch= (horizontal size), yinch= (vertical size), xll=, xur=, yll=, yur= (x and y coordinates for lower-left and upper-right corners). If not provided, they are calculated from screenht and screenwd.

These parameters apply to sfcontour, sfgraph, sfgrey, sfplotrays, and sfwiggle.