arrangePlots: Arrange plots

View source: R/arrangePlots.R

arrangePlotsR Documentation

Arrange plots

Description

Get an appropriate row/column combination (for par(mfrow)) for arranging a given number of plots within a plotting window.

Usage

arrangePlots(n.plots, landscape = FALSE)

Arguments

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.

Details

This function is used internally by optiThresh, but can also be useful outside it.

Value

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.

Author(s)

A. Marcia Barbosa

See Also

plot, layout

Examples

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

modEvA documentation built on Oct. 30, 2024, 1:06 a.m.