ggplotGrid: Arrange a List of ggplots

Description Usage Arguments Author(s) Examples

Description

Arrange a list of ggplots with grid.arrange and output on local graphic device or as pdf/png when a path is supplied. ggplotGridA4 writes the plots to a DIN A4 (8 x 11 inches) pdf file directly.

Usage

1
2
3
4
5
6
ggplotGrid(l, path, ncol = 1, nrow = 1, width = 8, height = 11,
  res = 300, pdf.cairo = TRUE, onefile = TRUE, ...)

ggplotGridA4(l, path, ncol = 2, nrow = 1, wide = TRUE)

ggplotlist(x, ncol = 1, path, width = 11, height = 8)

Arguments

l

List with ggplot objects.

path

Plot to file of type pdf or png. Determine type by path ending (.pdf or .png).
Optional in ggplotlist: A character string that gives the path to export the plot to a file, ending with 'pdf' or 'png' (case insensitive). If missing, then the grid is returned to the current graphic device.

ncol

Number of columns.

nrow

Number of rows per page, only for pdfs.

width

For pdfs/pngs the width in inches, else ignored.

height

For pdfs/pngs the height in inches, else ignored.

res

Resolution in dpi for pngs.

pdf.cairo

Use cairo_pdf (or cairo_ps, svg) instead of pdf

onefile

Create one file, see cairo_pdf.

...

Forwarded to cairo_pdf

wide

Wide format pdf pages (11x8 inches).

x

A list containing at least one ggplot object of class gg.

Author(s)

Sven E. Templer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#

## Not run: 
library(ggplot2)
d <- data.frame(a=1:5,b=1:5)
x <- list(
  ggplot(d, aes(x=a,y=b,col=b)) + geom_line(),
  ggplot(d, aes(x=a,y=b,shape=factor(b))) + geom_point())
ggplotlist(x, 2)
## End(Not run)

#

setempler/miscset documentation built on May 29, 2019, 8 p.m.