Last chance! 50% off unlimited learning
Sale ends in
nrow
and ncol
are given a nrow
-by-ncol
grid of subplots are created. If only argument n
is given
then a r-by-s grid is created where |r-s| <= 1,="" i.e.="" a="" square="" or="" almost="" of="" subplots="" is="" created.="" if="" n and nrow
is
given then a grid with nrow
rows and at least n
subplots
are created. Similar if n
and ncol
is given.
The argument byrow
specifies if the order of the subplots
should be rowwise (byrow=TRUE
) or columnwise.
## S3 method for class 'default':
subplots(n=1, nrow=NULL, ncol=NULL, byrow=TRUE, ...)
TRUE
, the panels are ordered row by row in the grid,
otherwise column by column.matrix
containing the order of plots.layout
and layout.show
().subplots(nrow=2, ncol=3) # 2-by-3 grid of subplots
subplots(n=6, nrow=2) # 2-by-3 grid of subplots
subplots(n=5, ncol=2) # 3-by-2 grid of subplots
subplots(1) # (Reset) to a 1-by-1 grid of subplots
subplots(2) # 1-by-2 grid of subplots
subplots(3) # 2-by-2 grid of subplots
l <- subplots(8) # 3-by-3 grid of subplots
layout.show(length(l))
Run the code above in your browser using DataLab