Assume
you want a grid of five plots. Before starting to write code, you
must first decide what grid dimensions you want to set (how many columns
and rows) and whether you want to permit an empty cell in the grid.
If do not want an empty cell, you must limit the grid to five cells,
which gives you two choices for the grid dimensions: five columns
by one row (5x1), or one column by five rows (1x5).
To specify
the grid size, you use the COLUMNS= or ROWS= option in the LAYOUT
GRIDDED statement. To use ROWS=, you must also specify ORDER=COLUMNMAJOR.
Two explicit
specifications could be used to create the following grid, which contains
one row and five columns:
layout gridded / columns=5;
/* plot defintions */
endlayout;
|
When the number
of columns is specified, you place a limit on how many columns can
be displayed across a row. The COLUMNS= option is honored only if
ORDER=ROWMAJOR (the default).
In the example code to the left,
if you were to include more than five plot definitions, additional
rows (with five columns) would be added automatically to accommodate
all of the cells that are needed to display all specified plot definitions.
|
layout gridded / order=columnmajor
rows=1;
/* plot definitions */
endlayout;
|
When the number
of rows is specified, you place a limit on how many rows can be displayed
down a column. The ROWS= option is honored only if ORDER=COLUMNMAJOR.
In the example code
to the left, if you were to include more than five plot definitions,
additional columns would be added automatically, but the grid would
not wrap to a second row because the ROWS= setting limits the grid
to a single row.
|
If you are willing to have an
empty cell in the grid, you could use a 2x3 or a 3x2 grid:
layout gridded / columns=3 ;
endlayout;
By default,
the layout uses the ORDER=ROWMAJOR setting to populate grid cells.
This specification essentially means "fill in all cells in the top
row (starting at the top left) and then continue to the next row below."
COLUMNS=1 by default when ORDER=ROWMAJOR, so you must specify an
alternative setting to increase the number of columns in the grid:
layout gridded / columns=3 ;
/* plot1 definition */
/* plot2 definition */
/* plot3 definition */
/* plot4 definition */
/* plot5 definition */
endlayout;
Alternatively,
you can specify ORDER=COLUMNMAJOR, which means "fill in all cells
in the left column and then continue to the next column to the right."
ROWS=1 by default when ORDER=COLUMNMAJOR, so you must specify an
alternative setting to increase the number of rows in the grid:
layout lattice / rows=2 order=columnmajor ;
/* plot1 definition */
/* plot2 definition */
/* plot3 definition */
/* plot4 definition */
/* plot5 definition */
endlayout;