decideMfrow: Decide plot panel rows, columns for par(mfrow)

decideMfrowR Documentation

Decide plot panel rows, columns for par(mfrow)

Description

Decide plot panel rows, columns for par(mfrow)

Usage

decideMfrow(n, method = c("aspect", "wide", "tall"), doTest = FALSE, ...)

Arguments

n

integer number of plot panels

method

character string indicating the type of layout to favor.

"aspect"

uses the device size and aspect ratio of the plot to try to maintain roughly square plot panels.

"wide"

tries to keep the columns and rows similar, erring on the side of more columns than rows.

"tall"

tries to keep the columns and rows similar, erring on the side of more rows than columns.

doTest

logical whether to provide a visual test. Note that n is required as the number of plot panels requested.

...

additional parameters are ignored.

Details

This function returns the recommended rows and columns of panels to be used in par("mfrow") with R base plotting. It attempts to use the device size and plot aspect ratio to keep panels roughly square. For example, a short-wide device would have more columns of panels than rows; a tall-thin device would have more rows than columns.

The doTest=TRUE argument will create n number of panels with the recommended layout, as a visual example.

Value

numeric vector length=2, with the recommended number of plot rows and columns, respectively. It is intended to be used directly in this form: par("mfrow"=decideMfrow(n=5))

See Also

Other jam plot functions: adjustAxisLabelMargins(), coordPresets(), drawLabels(), getPlotAspect(), groupedAxis(), imageByColors(), imageDefault(), minorLogTicksAxis(), nullPlot(), plotPolygonDensity(), plotRidges(), plotSmoothScatter(), shadowText_options(), shadowText(), showColors(), smoothScatterJam(), sqrtAxis(), usrBox()

Examples

# display a test visualization showing 6 panels
decideMfrow(n=6, doTest=TRUE);

# a manual demonstration creating 6 panels
n <- 6;
par(mfrow=decideMfrow(n));
for(i in seq_len(n)){
   nullPlot(plotAreaTitle=paste("Plot", i));
}


jmw86069/jamba documentation built on Oct. 9, 2024, 10:52 a.m.