Description Usage Arguments Details See Also Examples
Get the matrix corresponding to the layout of panels in a figure, given relative widths of columns in that figure
1 | get.layout(nr, nc, ratios, return_r = FALSE)
|
nr |
number of rows in the figure |
nc |
number of columns in the figure |
ratios |
numeric vector with length equal to |
return_r |
logical. if FALSE (default) a layout matrix is returned; otherwise returns a vector specifying same relative widths as |
Returns a matrix that can be supplied to layout
to specify the arrangement and size of figure panels. Current version assumes that all rows will have equal height, but that columns may have variable width; however, get.layout
can be called twice to generate the matrix specifying variable widths and heights (see examples), so long as all panels in a given row have the same height, and all panels in a given column have the same width. Also note that the ratios do not need to be integers - this feature makes it easy and fast to adjust figure layout.
See rbLib-package
for package overview.
1 2 3 4 5 6 7 8 9 10 | layout(get.layout(nr=3, nc=3, ratios=c(4.2, 3, 8.1)))
for(i in 1:9){plot(rnorm(5))}
# calling get.layout twice can allow you to specify
# variable widths and variable heights
c.h <- get.layout(nr=3, nc=3, ratios=c(4.2, 3, 8.1)) # from previous example
r.w <- get.layout(3, 3, c(1.5, 2, 2.5), TRUE) # integers of relative widths
layout.mat <- matrix(rep(c(c.h), rep(r.w, ncol(c.h))), ncol=ncol(c.h))
layout(layout.mat)
for(i in 1:9){plot(rnorm(5))}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.