
Last chance! 50% off unlimited learning
Sale ends in
Set the panel width/height of a ggplot to a fixed value.
set_panel_size(p = NULL, g = ggplot2::ggplotGrob(p), file = NULL,
margin = unit(1, "mm"), width = unit(4, "cm"), height = unit(4,
"cm"))
ggplot2
gtable
optional output filename
grid unit
grid unit, requested panel width
grid unit, requested panel height
gtable with fixed panel sizes
# NOT RUN {
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))
# }
Run the code above in your browser using DataLab