Aligning axes of R plots on one side of a grid together

You can use patchwork. Currently there are a couple of packages that can align plots (eg., cowplot, egg, ggpubr), however with this more complicated case only patchwork worked for me (and it's relatively easy to use; syntax is intuitive).

# devtools::install_github("thomasp85/patchwork")
library(patchwork)

pq1_plop + pq1_status + pq2_plop + pq2_status + pq3_plop + pq3_status +
plot_layout(ncol = 2, widths = c(10, 1))

With patchwork you just add (+) one ggplot2 plot to another and in the end specify layout (using plot_layout).

enter image description here


Generally speaking, it could be a oneliner with cowplot:

plot_grid(pq1_plop, pq1_status, pq2_plop, pq2_status, pq3_plop, pq3_status,
          ncol = 2, nrow = 3, align = "v")

But because your *_status plots are misbehaving a bit, we need to build a nested plot grid:

plot_grid(plot_grid(pq1_plop, pq2_plop, pq3_plop, 
                    ncol = 1, rel_heights = c(5, 9, 13), align = "v"), 
          plot_grid(pq1_status, pq2_status, pq3_status, 
                    ncol = 1, rel_heights = c(5, 9, 13)), 
          nrow = 1, rel_widths = c(10, 1))

The beauty about cowplot is that you can easily define relative widths and heights (without having to dive into grobs and units). This way, we can force the intervals between the horizontal lines in each plot to be of roughly the same size.

1


Same with patchwork:

pq1_plop + pq1_status + pq2_plop + pq2_status + pq3_plop + pq3_status +
    plot_layout(ncol = 2, widths = c(10, 1), heights = c(5, 9, 13))

2