Saving multiple ggplots from ls into one and separate files in R

后端 未结 4 598
独厮守ぢ
独厮守ぢ 2020-12-01 00:08

I have several ggplots as objects on my ls. I want to save them as separate files (although I would also be interested to know how to save them all under 1 big file). I have

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 01:02

    Note that you don't have to work with lapply. Suppose you have a list containing all your plots:

    MyPlots = list(plot1, plot2, plot3)
    

    Just use:

    pdf("all.pdf")
    MyPlots
    dev.off()
    

提交回复
热议问题