How can I align two graphs to the same x axis?

I have stacked two different type graphs on top of each other using grid.arrange function.
Despite they are different types, they have the same x axis - so I would like to adjust/align them so that their x axes are equal. How can I do that?

It seems, that grid.arrange equalizes their width when stacking, but this is not what I would like to achieve.

Thanks for help!

You could try other approaches to getting your multiplot (e.g. patchwork or cowplot)? You can also resort to a manual shift to one of the plots using theme(plot.margin = unit(c(1, 1, 1, 5, "mm") (note I just made up the top, left, bottom, right mm estimates as a demo).

1 Like

This vignette of the {egg} :package: can also help on multiplot arrangement
https://cran.r-project.org/web/packages/egg/vignettes/Ecosystem.html

2 Likes