0

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!

benson23
  • 16,369
  • 9
  • 19
  • 38
Tahnee
  • 77
  • 5
  • The error is: Error in UseMethod("grid.draw") : no applicable method for 'grid.draw' applied to an object of class "c('list', 'ggarrange')" – Tahnee Feb 18 '22 at 16:11

1 Answers1

2

Instead of using ggsave, you could use the pdf device directly:

pdf('/path/image.pdf')
print(multi.page)
dev.off()

And you will have a pdf with your two plots on separate pages.

Allan Cameron
  • 147,086
  • 7
  • 49
  • 87