auto.layout: Automatically select the layout.

Description Usage Arguments Value Author(s) Examples

View source: R/auto.layout.R

Description

Given a particular number of plots, auto.layout will automatically determine the arrangement of each plot using the layout function. See examples.

Usage

1

Arguments

n

the number of plots

layout

should the fuction return a preallocated layout object? If FALSE, it returns a matrix

Value

either a matrix or a layout object

Author(s)

Dustin Fife

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## plot six plots
auto.layout(6)
for (i in 1:6){
	plot(rnorm(100), rnorm(100))	
}
## same as mar(mfrow=c(3,2))
par(mfrow=c(3,2))
for (i in 1:6){
	plot(rnorm(100), rnorm(100))	
}
## default for odd number of plots using mfrow looks terrible
par(mfrow=c(3,2))
for (i in 1:5){
	plot(rnorm(100), rnorm(100))	
}
## much better with auto.layout
auto.layout(5)
for (i in 1:5){
	plot(rnorm(100), rnorm(100))	
}

dustinfife/fifer documentation built on Oct. 31, 2020, 3:36 p.m.