set_panel_size | R Documentation |
Use strict size for panels when number of panels in rows/columns are not equal.
set_panel_size(
p = NULL,
file = NULL,
margin = unit(1, "cm"),
width = unit(4, "cm"),
height = unit(4, "cm")
)
p |
a |
file |
optional file name if result should be saved to file, passed
to |
margin |
a |
width, height |
a |
Baptiste Auguie
library('ggplot2')
library('gridExtra')
p1 <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_wrap(~ vs)
p2 <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_wrap(~ gear)
grid.arrange(p1, p2)
g1 <- set_panel_size(p1)
g2 <- set_panel_size(p2)
grid.arrange(g1, g2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.