set_panel_size: set_panel_size

Description Usage Arguments Value Examples

View source: R/set_panel_size.r

Description

Set the panel width/height of a ggplot to a fixed value.

Usage

1
2
3
set_panel_size(p = NULL, g = ggplot2::ggplotGrob(p), file = NULL,
  margin = unit(1, "mm"), width = unit(4, "cm"), height = unit(4,
  "cm"))

Arguments

p

ggplot2

g

gtable

file

optional output filename

margin

grid unit

width

grid unit, requested panel width

height

grid unit, requested panel height

Value

gtable with fixed panel sizes

Examples

1
2
3
p1 <- qplot(mpg, wt, data=mtcars, colour=cyl)
p2 <- p1 + facet_wrap(~carb, nrow=1)
grid.arrange(grobs=lapply(list(p1,p2), set_panel_size))

Example output

Loading required package: gridExtra
Loading required package: ggplot2

egg documentation built on July 13, 2019, 9:03 a.m.