arrangePlots | R Documentation |
Get an appropriate row/column combination (for par(mfrow)
) for arranging a given number of plots within a plotting window.
arrangePlots(n.plots, landscape = FALSE)
n.plots |
number of plots to be placed in the graphics device. |
landscape |
logical, whether the plotting window should be landscape/horizontal (number of columns larger than the number of rows) or not. The value does not make a difference if the number of plots makes for a square plotting window. |
This function is used internally by optiThresh
, but can also be useful outside it.
An integer vector of the form c(nr, nc) indicating, respectively, the number of rows and of columns of plots to set in the graphics device.
A. Marcia Barbosa
plot
, layout
arrangePlots(10)
arrangePlots(10, landscape = TRUE)
# a more practical example:
data(iris)
names(iris)
# say you want to plot all columns in a nicely arranged plotting window:
par(mfrow = arrangePlots(ncol(iris)))
for (i in 1:ncol(iris)) {
plot(1:nrow(iris), iris[, i])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.