p1 <- qplot(1:10, 1:10)
p2 <- qplot(1:10, (1:10)^2)
p3 <- qplot(1:10, (1:10)^3)
p4 <- qplot(1:10, (1:10)^4)
# simple grid
plot_grid(p1, p2, p3, p4)
# simple grid with labels and aligned plots
plot_grid(p1, p2, p3, p4, labels=c('A', 'B', 'C', 'D'), align="hv")
# manually setting the number of rows
plot_grid(p1, p2, p3, nrow=3, labels=c('A', 'B', 'C', 'D'), label_size=12, align="v")
# missing plots in some grid locations
plot_grid(p1, NULL, NULL, p2, p3, NULL, ncol=2,
labels=c('A', 'B', 'C', 'D', 'E', 'F'), label_size=12, align="v")
# making rows and columns of different widths/heights
plot_grid(p1, p2, p3, p4, align='hv', rel_heights=c(2,1), rel_widths=c(1,2))