Arrange ggplots together in custom ratios and spacing

前端 未结 2 1619
走了就别回头了
走了就别回头了 2020-12-30 10:27

I am trying to combine n number of barplots with one common label plot at the bottom. My problem is that grid.arrange combines the two plots in 50%-50%. I am looking for som

2条回答
  •  暖寄归人
    2020-12-30 10:54

    grid.arrange(plot1, plot2, widths=c(0.7, 0.3), ncol=2)
    

    sorry for your example:

    grid.arrange(plot1, plot2, heights=c(0.7, 0.3), nrow=2)
    

    EDIT - for spacing between plots:

    blank<-rectGrob(gp=gpar(col="white")) # make a white spacer grob
    grid.arrange(plot1, blank, plot2, heights=c(0.7, 0.05, 0.25), nrow=3)
    

提交回复
热议问题