get.layout: Get matrix for figure layout

Description Usage Arguments Details See Also Examples

View source: R/get.layout.R

Description

Get the matrix corresponding to the layout of panels in a figure, given relative widths of columns in that figure

Usage

1
get.layout(nr, nc, ratios, return_r = FALSE)

Arguments

nr

number of rows in the figure

nc

number of columns in the figure

ratios

numeric vector with length equal to nc specifying relative widths of panels

return_r

logical. if FALSE (default) a layout matrix is returned; otherwise returns a vector specifying same relative widths as ratios, but as integers.

Details

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 Also

See rbLib-package for package overview.

Examples

 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))}

rBatt/rbLib documentation built on May 26, 2019, 7:45 p.m.