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))

baptiste/egg documentation built on May 30, 2021, 1:24 a.m.