
Last chance! 50% off unlimited learning
Sale ends in
plot_grid(..., plotlist = NULL, align = c("none", "h", "v", "hv"), nrow = NULL, ncol = NULL, scale = 1, rel_widths = 1, rel_heights = 1, labels = NULL, label_size = 14, hjust = -0.5, vjust = 1.5, cols = NULL, rows = NULL)
rel_widths = c(2, 1)
would make the first column twice as wide as the
second column.rel_widths
does, but for rows rather than columns.labels="AUTO"
to
auto-generate upper-case labels or labels="auto"
to auto-generate lower-case labels.ncol
.nrow
.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, auto-generate upper-case labels
plot_grid(p1, p2, p3, nrow=3, labels="AUTO", label_size=12, align="v")
# missing plots in some grid locations, auto-generate lower-case labels
plot_grid(p1, NULL, NULL, p2, p3, NULL, ncol=2,
labels="auto", 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))
Run the code above in your browser using DataLab