1

I have the following code:

p_all<-plot_grid( p_as + theme(legend.position="none"), 
              p_cd + theme(legend.position="none"),
              p_cu + theme(legend.position="none"),
              p_pb + theme(legend.position="none"),
              p_ni + theme(legend.position="none"),
              p_zn + theme(legend.position="none"),
              p_hg + theme(legend.position="none"),
              p_cr + theme(legend.position="none"),
       align = 'v',
       hjust = 0,
       ncol = 2
)

p_all2<-plot_grid( p_all, legend_b, ncol = 1, rel_heights = c(6, .2))
p_all2

grid.arrange(arrangeGrob(p_all2, 
                     left = textGrob(label=expression(paste('mg'~g^-1~'Trockenmasse')), rot = 90, vjust = 1),
                     right = textGrob(label = "W (m)", rot=270, vjust =1.5)))

which produces the following graph:

enter image description here

I have to use plot_grid as I am using sec_axis to display waterlevel on the second y-axis.

How can I get the last 2 plots at the bottom to have the same size as the other plots. I know that the difference is size is due to the x-axis. Is there a way to remove the x-axis also from the last two plots by using axis.title.x = element_blank() and axis.ticks.x = element_blank() and then adding the x-axis to a separate row right under the last two plots?

Matt
  • 323
  • 2
  • 12
  • 1
    You might look at package **egg**, which can be a nice alternative to **cowplot** for these scenarios where you want a shared axis and you are having trouble with spacing. You can see one example [in this SO answer](https://stackoverflow.com/questions/47614314/how-to-put-plots-without-any-space-using-plot-grid/47615304#47615304). – aosmith Jun 14 '19 at 13:26

0 Answers0