1

I have a series of line plots, made with ggplot2.

I want to arrange them in one plot, and I can do this with plot_grid from the cowplot package. However, because the labels (Universität vs. SP) are unequal in length, the plots are not aligned properly. What I want is that the grid area is perfectly aligned along all plots. Any idea how I can achieve this?

This is my code:

cowplot::plot_grid(plot_party, plot_educ, plot_sex, labels=c("A", "B", "C"), ncol = 1, nrow = 3)

example

Mario
  • 2,393
  • 2
  • 17
  • 37

1 Answers1

2

in the cowplot::plot_grid() function you can specify the align parameter which controlls the alignment as follows:

  • default ("none" )
  • horizontally ("h")
  • vertically ("v")
  • align in both directions ("hv")

So you need to run:

cowplot::plot_grid(plot_party, plot_educ, plot_sex, 
                   labels = c("A", "B", "C"), 
                   ncol = 1, nrow = 3,
                   align = "v")
Roman
  • 17,008
  • 3
  • 36
  • 49