subplots.Device: Creates a grid of subplots

Description Usage Arguments Value Author(s) See Also Examples

Description

Creates a grid of subplots in the current figure. If arguments 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 a square 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.

Usage

1

Arguments

n

If given, the minimum number of subplots.

nrow

If given, the number of rows the grid of subplots should contain.

ncol

If given, the number of columns the grid of subplots should contain.

...

Not used.

Value

Returns the matrix containing the order of plots.

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

See Also

layout and layout.show().

Examples

1
2
3
4
5
6
7
8
   Device$subplots(nrow=2, ncol=3)  # 2-by-3 grid of subplots
   Device$subplots(n=6, nrow=2)     # 2-by-3 grid of subplots
   Device$subplots(n=5, ncol=2)     # 3-by-2 grid of subplots
   Device$subplots(1)               # (Reset) to a 1-by-1 grid of subplots
   Device$subplots(2)               # 1-by-2 grid of subplots
   Device$subplots(3)               # 2-by-2 grid of subplots
   l <- Device$subplots(8)          # 3-by-3 grid of subplots
   layout.show(length(l))

HenrikBengtsson/R.graphics documentation built on May 6, 2019, 11:53 p.m.