2
votes

I want to stack 3 plots into 1 using ggarrange but the x-axis elements (dates) of the bottom plot are always disappeared.

For example, here axis elements of plot_3 (Z) are missing.

ggarrange(plot_1, plot_2, plot_3 + rremove("x.text"), 
          nrow = 3, align = "h")

Result 1

And when I change the order, axis elements of plot_2(Y) are now disappeared.

ggarrange(plot_1, plot_3, plot_2 + rremove("x.text"), 
          nrow = 3, align = "h")

Result 2

I tried to adjust the margins in each ggplot, but the same problem persists. So, I guess it must be something to do with the margins in ggarrange .

By the way, I also tried to remove all the x-axis title of the first two plots, and keep the title of the last (bottom) plot, but again, the dates are still missing.

1
but are you not removing them with rremove("x.text")user20650
ps see egg::ggarrange if you also want the panels to alignuser20650
Right! How could I missed that?!!dss333

1 Answers

3
votes

I think that the function theme() would be useful

ggarrange(plot_1, plot_2, plot_3 + rremove("x.text"), 
          nrow = 3, align = "h")+
  theme(plot.margin = margin(0.1,0.1,2,0.1, "cm"))