# Plot/Multi

Plot | Verbs | Class Commands Data Options Outputs Types | Colors Fonts Keys Text YAxes | Function **Multi**Shape

The multi command creates a multiplot in the current subwindow, sets plot defaults.

A multiplot is an array of plots that typically have their axes linked in some way. The commands xgroup and ygroup link x and y axes.

- If two plots have the same xgroup value, then their x-axes have the same range. If the plots are also in the same column, then the x-axes are lined up and have the same labels.
- If two plots have the same ygroup value, then their y-axes have the same range. If the plots are also in the same row, then the y-axes are lined up and have the same labels.

Apart from linking axes, each plot is drawn independently.

The parameter to multi has two forms:

1. a pair of numbers: rows, columns. This sets up a multiplot array using equal divisions of the current window for each element of the shape.

For example:

pd 'multi 2 3'

creates a 2 row by 3 column multiplot.

2. a pair of lists, separated by comma: relative size of each row, relative size of each column

For example:

pd 'multi 4 2, 1 1 2'

creates a 2 row by 3 column multiplot. The first row has twice the height of the second, and the last column has twice the width of the first two columns.

### Options

The multi command should be followed by zero or more options, then the data for the multiplot. The options are the same as before, with the following extensions:

#### Axis groups

*xgroup* sets the xgroups for the multiplots.

pd 'xgroup keylist'

The default for a multiplot of shape r c is:

pd 'xgroup ',": ,i. r,c'

Here, keylist is either a single number, or a list of length c, or list of length r * c. Plots with the same key value are drawn to the same x group.

*ygroup* sets the ygroups for the multiplots.

pd 'ygroup keylist'

The default for a multiplot of shape r c is:

pd 'ygroup ',": ,i. r,c'

Here, keylist is either a single number, or a list of length r, or list of length r * c. Plots with the same key value are drawn to the same y group.

For example:

a) all graphs independent (the default)

pd 'xgroup ',": ,i.r,c' pd 'ygroup ',": ,i.r,c'

b) all graphs in a row have the same y axis and all graphs in a column the same x axis

pd 'xgroup ',": i.c pd 'ygroup ',": i.r

c) all graphs with the same axes.

pd 'xgroup 0' pd 'ygroup 0'

d) A cross shaped pattern:

pd 'xgroup 0 1 0 2 1 3 0 1 0' pd 'ygroup 0 1 0 2 2 2 0 3 0'

#### Captions

The following gives captions for each column, and similarly for each row:

pd 'xcaption "col 1" "col 2" "col3"'

#### Keys

An initial Key definition is for the entire multiplot and must be an outside key.

Each plot may also have its own Key definition.

#### Data

The data for a multiplot is a boxed list, with one item for each plot.

Each item is either a 2-element list, or a 2-column table of: options;data, where:

- option is a list of options, either as a LF or ';' delimited list, or as a matrix. These options are applied in addition to any options given already. The option list may include text commmands, but other commands are ignored. Second Y axes are not supported in multiplots, and font commands other than symbolfont and textfont are applied to each subplot.
- data is a data set in the normal form for pd.

#### Restrictions

Second Y axes and 3D plots are not yet supported in multiplots.