'How to save 2 separate ggplots overlapping in the same pdf in R?

I have 2 ggplots: plot1 and plot2

When I show them in R using:

multi.page <- ggarrange(plot1, plot2,
                        nrow = 1, ncol = 1) 

I get the overlap, but when I then want to safe this overlapping images as PDF it is not possible:

ggsave('/path/image.pdf',plot=multi.page,width=8,height=5)

Does anyone know a way?

Maybe with ggplot_add?

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source