Page Control in GrADS

Real and virtual pages

The "real" page is an 8.5x11 page in the landscape or portrait orientation. The orientation is specified when you first startup grads. The graphics output window is a representation of the real page on your computer screen. The graphics window can be any size at all. You can set the dimensions explicitly (in pixel coordinates) using the set xsize command, or you can simply resize the graphics window using your mouse. When it comes time to print the contents of the graphics window to a real page, the screen coordinates (in pixels) will be scaled so the graphics will fit in the real page in the same way they fit in the graphics window.

The "virtual" page is a page-within-a-page that fits within the limits of the real page. By default, the virtual page is the same as the real page, so that real page coordinates are exactly the same as virtual page coordinates. All graphics are drawn on the virtual page. The limits of the virtual page may be changed by using the following command:

After entering a set vpage command, GrADS will return the size of the virtual page in inches. Any arguments to graphics commands that require page coordinates in inches are to be given in virtual page coordinates. For example, to draw a plot in the lower left quadrant of the real page, use the following command:

GrADS will return the following virtual page dimensions:

If the virtual page has the same aspect ratio as the real page, Grads will give it the same dimensions as the real page -- in this case the virtual page is a mini version of an 11"x8.5" page. Here's another example where the virtual page is a centered square:

GrADS will return the following virtual page dimensions:

On the real page the plot will be within a 3" square, but on the virtual page in Grads the plot will be within an 8.5" square. Remember that any arguments to graphics commands that require page coordinates in inches are to be given in virtual page coordinates.

To return to the default state where the virtual page equals the real page, enter:

Controlling the plot area

It is possible to control the area within the virtual page where GrADS draws contour plots, maps, or line graphs. The command is:

This area does not include axis labels, titles, color bars, etc., so be sure to provide for adequate margins in order to see these features. Note that the plot area is specified in terms of virtual page units.

GrADS chooses an appropriate default plotting area depending on the type of graphics output. To return to this default, enter:

Line graphs and contour plots that don't contain a map will be scaled to fill the entire plot area. Any plot that contains a map projection will be scaled to fit within the plotting area while maintaining a correct lat/lon aspect ratio. Thus, the map may not fill the entire plotting area except under certain lat/lon ranges. This feature may be turned off by setting the map projection to "scaled". See the reference page for set mproj for additional map projection options.

Drawing Multi-Panel Plots

For drawing multi-panel plots, use set vpage to define several virtual pages that fit within the limits of the real page. Virtual pages may overlap. The sample script called demonstrates how to set up virtual page coordinates for a multi-panel plot with a specified number of rows and columns. It uses a GrADS script function called panels.gsf.

If you want to place a label or some other graphic element in each panel, the position is given in virtual page coordinates. These coordinates will be the same no matter which panel you're in. This makes it easy to shift the labels in one direction or another to accomodate the graphics.

Do not use set parea to draw multiple plots on one page. That is not what parea was designed for. It is far better (and easier!) to use the set vpage command as described above.