This code produces the cowplot grid shown below.
library(tidyverse)
library(cowplot)
plot_1 <- tibble(x = rnorm(25),
y = rnorm(25)) %>%
ggplot(aes(x = x, y = y)) +
geom_point()
plot_grid(plot_1, plot_1, labels=c('a', 'b'))
But let's say I want to change the aspect ratio. Easily done, or so I thought, with ggplot
's theme.
plot_2 <- plot_1 + theme(aspect.ratio = 1/2)
plot_grid(plot_2, plot_2, labels=c('a', 'b'))
But the result is this.
I also tried
plot_3 <- plot_1 + coord_fixed(ratio=1/2)
plot_grid(plot_3, plot_3, labels=c('a', 'b'))
But the results are the same.
The labels are where they were in the original. I want them plots to be just under the labels and none of the whitespace.