With three individual plots plot1
, plot2
and plot3
, the command plot_grid(plot1, plot2, plot3, ncol = 2)
creates a 2 x 2 plot area, in which the top row consists of two plots and the bottom row of a single plot aligned to the left. Hence, the bottom right corner of the plot area is empty.
How can I center the individual plot3
on the bottom row so that the 2 x 2 does not appear to be missing a fourth plot? Also, I would need plot3
to have the same size as the other two plots.
Reproducible example
library(ggplot2)
library(cowplot)
p1 <- ggplot(mtcars, aes(disp, mpg)) +
geom_point()
p2 <- ggplot(mtcars, aes(disp, mpg)) +
geom_point()
p3 <- ggplot(mtcars, aes(disp, mpg)) +
geom_point()
plot_grid(p1, p2, p3, ncol = 2) # creates 2 x 2 plot area with missing empty bottom right corner (instead of p3 centered on bottom row)
With nested cowplots:
library(cowplot)
library(ggplot2)
plot_grid(
plot_grid(p1, p2, nrow = 1, ncol = 2),
plot_grid(NULL, p3, NULL, nrow = 1, rel_widths = c(0.5, 1, 0.5)),
nrow = 2
)