Multiple plots on one page using ggplot

前端 未结 2 1282
一向
一向 2021-01-20 14:07

I have 12 plots generated by a loop and I want to plot them with 3 rows and 2 columns on one page (2 pages in total). I know how to do it in R

pdf(\"1.pdf\")         


        
2条回答
  •  面向向阳花
    2021-01-20 14:31

    marrangeGrob is a convenient wrapper for multiple pages,

    marrangeGrob(lg, ncol=2, nrow=3)
    

    or you can call grid.arrange() explicitly twice,

    grid.arrange(grobs = lg[1:6], ncol=2)
    grid.arrange(grobs = lg[7:12], ncol=2)
    

提交回复
热议问题