gridExtra (version 2.0.0)

arrangeGrob: Arrange multiple grobs on a page

Description

Set up a gtable layout to place multiple grobs on a page

Usage

arrangeGrob(..., grobs = list(...), layout_matrix, vp = NULL,
  name = "arrange", as.table = TRUE, respect = FALSE, clip = "off",
  nrow = NULL, ncol = NULL, widths = NULL, heights = NULL, top = NULL,
  bottom = NULL, left = NULL, right = NULL, padding = unit(0.5, "line"))

grid.arrange(..., newpage = TRUE)

marrangeGrob(grobs, ncol, nrow, ..., top = quote(paste("page", g, "of", pages)))

Arguments

...
grobs, gtables, ggplot or trellis objects
grobs
list of grobs
layout_matrix
optional layout
vp
viewport
name
argument of gtable
as.table
logical: bottom-left to top-right or top-left to bottom-right
respect
argument of gtable
clip
argument of gtable
nrow
argument of gtable
ncol
argument of gtable
widths
argument of gtable
heights
argument of gtable
top
optional string, or grob
bottom
optional string, or grob
left
optional string, or grob
right
optional string, or grob
padding
unit of length one, margin around annotations
newpage
open a new page

Value

  • arrangeGrob returns a gtable

    marrangeGrobm returns a list of class arrangelist

Functions

  • arrangeGrob: return a grob without drawing
  • grid.arrange: draw on the current device
  • marrangeGrob: interface to arrangeGrob that can dispatch on multiple pages

Details

Using marrangeGrob, if the layout specifies both nrow and ncol, the list of grobs can be split into multiple pages. On interactive devices print open new windows, whilst non-interactive devices such as pdf call grid.newpage() between the drawings.

Examples

Run this code
library(grid)
grid.arrange(rectGrob(), rectGrob())
library(ggplot2)
pl <- lapply(1:11, function(.x) qplot(1:10,rnorm(10), main=paste("plot",.x)))
ml <- marrangeGrob(pl, nrow=2, ncol=2)
## interactive use; open new devices
ml
## non-interactive use, multipage pdf
ggsave("multipage.pdf", ml)

Run the code above in your browser using DataCamp Workspace