Difference between revisions of "Common pen parameters"

From Madagascar
Jump to navigation Jump to search
(New page: Lack of auto-documentation for the common pen parameters [http://sourceforge.net/tracker/?func=detail&aid=2709454&group_id=162909&atid=825645 is considered a bug] This page attempts to ga...)
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Lack of auto-documentation for the common pen parameters [http://sourceforge.net/tracker/?func=detail&aid=2709454&group_id=162909&atid=825645 is considered a bug]
+
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.
  
This page attempts to gather information from the mailing list in a structured form.
+
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.
 
 
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"... <tt>size=absolute</tt> and <tt>size=relative</tt>
 
Vplot has two output "styles"... <tt>size=absolute</tt> and <tt>size=relative</tt>
Line 17: Line 13:
 
The user can override the device's default by putting "size=a" or "size=r" on the command line.
 
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
+
<tt>xwmax= ywmax= xwmin= ywmin=</tt> 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.
 
set at the limits of the device screen. They DON'T reset where the "device screen" is.
  
Line 27: Line 23:
 
to dovplot. But my guess is if the piece you are wanting is small, it doesn't need as many pixels to describe it.
 
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:
+
The "vplot2gif" script 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>
+
<syntaxhighlight lang="bash">
 
ppmpen n2=$height n1=$width ppi=$ppi size=a xcenter=$xcen ycenter=$ycen
 
ppmpen n2=$height n1=$width ppi=$ppi size=a xcenter=$xcen ycenter=$ycen
</bash>
+
</syntaxhighlight>
  
 
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 "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" script does it in Python:
 
+
<syntaxhighlight lang="python">
The Madgascar "vplot2gif" does something similar but in Python:
 
 
 
 
run = 'ppmpen break=i n1=%d n2=%d ppi=%d size=a ' \
 
run = 'ppmpen break=i n1=%d n2=%d ppi=%d size=a ' \
 
                 'xcenter=%g ycenter=%g %s | ' \
 
                 'xcenter=%g ycenter=%g %s | ' \
 
                 'ppmquant 256 | ppmtogif > %s' % \
 
                 'ppmquant 256 | ppmtogif > %s' % \
 
                 (width,height,ppi,xcen,ycen,vppen,gif)
 
                 (width,height,ppi,xcen,ycen,vppen,gif)
 +
</syntaxhighlight>
 +
==Controlling figure size or aspect ratio==
 +
There are three basic parameters: <tt>screenratio</tt>, <tt>screenht</tt>, and <tt>screenwd</tt>. If <tt>screenwd</tt> is not provided, it is calculated as <tt>screenht/screenratio</tt>. The defaults are:
 +
<pre>
 +
screenratio=0.75
 +
screenht=10.24
 +
</pre>
 +
For a finer control, you can use <tt>xinch=</tt> (horizontal size), <tt>yinch=</tt> (vertical size), <tt>xll=</tt>, <tt>xur=</tt>, <tt>yll=</tt>, <tt>yur=</tt> (x and y coordinates for lower-left and upper-right corners). If not provided, they are calculated from <tt>screenht</tt> and <tt>screenwd</tt>.
 +
 +
These parameters apply to programs such as sfcontour, sfgraph, sfgrey, sfplotrays, and sfwiggle.

Latest revision as of 15:01, 8 April 2014

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 "vplot2gif" script 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:

ppmpen n2=$height n1=$width ppi=$ppi size=a xcenter=$xcen ycenter=$ycen

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" script does it in Python:

run = 'ppmpen break=i n1=%d n2=%d ppi=%d size=a ' \
                'xcenter=%g ycenter=%g %s | ' \
                'ppmquant 256 | ppmtogif > %s' % \
                (width,height,ppi,xcen,ycen,vppen,gif)

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:

screenratio=0.75
screenht=10.24

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 programs such as sfcontour, sfgraph, sfgrey, sfplotrays, and sfwiggle.