Recursive grid layout functions for graphics

Description

mfrow and mfcol setup a multi-figure layout scheme on a
grid in the current graphics device. Unlike other layout methods the
schemes can be used recursively to create complex layouts with very
simple commands.

Arguments

either a numeric vector of length one defining the number
of equally spaced rows or a vector specifying the relative height of
each row.

cols

either a numeric vector of length one defining the number
of equally spaced columns or a vector specifying the relative width of
each row.

n

if rows and cols are both not specified, then
n specifies the minimal number of cells that the layout
should contain. In that case rows and cols are
computed such that their product is at least n and the
resulting aspect ratio of the figures is as close to asp as
possible.

asp

numeric, desired aspect ratio of the figures when n
is used to specify the grid

add

logical, if TRUE then the layout scheme is added to
the layout stack, allowing recursive layouts. Otherwise the
currently layout is replaced with the new grid layout.

times

number of times this layout should be applied or
NA for unlimited. Any number larger than 1e6 is interpreted
as NA.

fig

boundaries of the figure that will be split using this
layout scheme.

...

additional arguments that will be passed to
par when a new figure is setup.

Details

mfrow and mfcol have a similar effect as the
corresponding graphics parameters, but they are more flexible
(allowing individual withs and heights) and construct a scheme that
can be used recursively with add = TRUE.

Note that the scheme layout method is incompatible with all other
layout methods that are not based on the scheme stack, such as
par(mfrow) or layout. It can be to a degree
combined with split.screen with add = TRUE if
used as a sub-layout thereof since screen uses a co-operative
manipulation of figures. However, in that case you should make sure
that the stack layout does not overflow (i.e., you plot only at most
as many plots as there are figures) or it will clear the device.

Value

object of the class scheme.

Note

All layout functions require R 2.13.0 or higher! If plots seemingly
don't move from the first figure then you either have old version or
other code has removed the neessary "before.plot.new" hook.