Common pen parameters

From Madagascar
Revision as of 15:48, 23 June 2009 by Nick (talk | contribs)
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.

Generic options for all these programs: "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."

From Joe's 2009-03-24 message to rsf-user:

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.

From Sergey's 2009-03-24 reply:

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' % \