Next: , Previous: Simple Examples, Up: graph


2.2 Non-square, displaced, and rotated plots

To alter the linear dimensions of the plotting box, and also to position it in a different part of the graphics display, you could do something like

     graph -T ps -h .3 -w .6 -r .1 -u .1 < datafile > plot.ps

Here the ‘-h’ and ‘-w’ options specify the height and width of the plotting box, and the ‘-r’ and ‘-u’ options indicate how far up and to the right the lower left corner of the plotting box should be positioned. All dimensions are expressed as fractions of the size of the graphics display. By default, the height and width of the plotting box equal 0.6, and the `upward shift' and the `rightward shift' equal 0.2. So the above example will produce a plot that is half as tall as usual. Compared to its usual position, the plot will be shifted slightly downward and to the left.

Several command-line options specify sizes or dimensions as fractions of the size of the plotting box. For example, ‘-S 3 .01’ specifies that the marker symbols for the following dataset should be of type #3, and should have a font size equal to 0.01, i.e., 0.01 times the minimum dimension (height or width) of the plotting box. If the ‘-h’ or ‘-w’ options are employed to expand or contract the plot, such sizes or dimensions will scale in tandem. That is presumably the right thing to do.

To rotate your plot by 90 degrees counterclockwise, you would add ‘--rotation 90’ to the graph command line. You would specify ‘--rotation 180’ to produce an upside-down plot. Any other angle may be specified, but angles other than 0, 90, 180, and 270 degrees are of interest primarily to postmodernists. The ‘--rotation’ option may be combined with the ‘-h’, ‘-w’, ‘-r’, and ‘-u’ options. If they appear together, the ‘--rotation’ option takes effect first. That is because ‘--rotation’ specifies the rotation angle of the graphics display, while the other options specify how the plotting box should be positioned within the graphics display. The two sorts of positioning are logically distinct.

The graphics display (sometimes called the `viewport') is an abstraction. For graph -T X, it is a popped-up window on an X display. For graph -T pnm and graph -T gif, it is a square or rectangular bitmap. In these three cases, the size of the graphics display can be set by using the ‘--bitmap-size’ option, or by setting the BITMAPSIZE environment variable. For graph -T tek, the graphics display is a square region occupying the central part of a Tektronix display. (Tektronix displays are 4/3 times as wide as they are high.) For graph -T regis, it is a square region occupying the central part of a ReGIS display. For graph -T ai, graph -T ps, graph -T pcl, and graph -T fig, by default it is a 8-inch square centered on an 8.5in by 11in page (US letter size). For graph -T hpgl, it is an 8-inch square, which by default is not centered. For graph -T svg and graph -T cgm, the default graphics display is an 8-inch square, though if the output file is placed on a Web page, it may be scaled arbitrarily.

The page size, which determines the default display size used by graph -T svg, graph -T ai, graph -T ps, graph -T cgm, graph -T fig, graph -T pcl, and graph -T hpgl, can be set by using the ‘--page-size’ option, or by setting the environment variable PAGESIZE. For example, setting the page size to "a4" would produce output for an A4-size page (21cm by 29.7cm), and would select a appropriate graphics display size. Either or both of the dimensions of the graphics display can be specified explicitly. For example, the page size could be specified as "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm". The dimensions of the graphics display are allowed to be negative (a negative dimension results in a reflection).

The position of the display on the page, relative to its default position, may optionally be adjusted by specifying an offset vector. For example, the page size could be specified as "letter,yoffset=1.2in", or "a4,xoffset=−5mm,yoffset=2.0cm". It is also possible to position the graphics display precisely, by specifying the location of its lower left corner relative to the lower left corner of the page. For example, the page size could be specified as "letter,xorigin=2in,yorigin=3in", or "a4,xorigin=0.5cm,yorigin=0.5cm".

The preceding options may be intermingled. However, graph -T svg and graph -T cgm ignore the "xoffset", "yoffset", "xorigin", and "yorigin" options, since SVG format and WebCGM format have no notion of the Web page on which the graphics display will ultimately be positioned. They interpret the "xsize" and "ysize" options as specifying a default size for the graphics display (it is merely a default, since the output file may be scaled arbitrarily when it is placed on a Web page).

For more information on page and graphics display sizes, see Page and Viewport Sizes.