p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) +
geom_boxplot(aes(gear, disp, group = gear))
p3 <- ggplot(mtcars) +
geom_bar(aes(gear)) +
facet_wrap(~cyl)
layout <- c(
area(1, 1),
area(1, 3, 3),
area(3, 1, 3, 2)
)
# Show the layout to make sure it looks as it should
plot(layout)
# Apply it to a alignpatches
align_plots(p1, p2, p3, design = layout)
Run the code above in your browser using DataLab