Arrange common plot width with facetted ggplot 2.0.0 & gridExtra

后端 未结 4 1281
余生分开走
余生分开走 2021-01-02 23:22

Since I have updated to ggplot2 2.0.0, I cannot arrange charts propperly using gridExtra. The issue is that the faceted charts will get compressed while other will expand. T

4条回答
  •  不知归路
    2021-01-02 23:43

    one option is to massage each plot into a 3x3 gtable, where the central cell wraps all the plot panels.

    Using the example from @SandyMuspratt

    # devtools::install_github("baptiste/egg") 
    grid.draw(egg::ggarrange(plots=plots, ncol=1))
    

    the advantage being that once in this standardised format, plots may be combined in various layouts much more easily, regardless of number of panels, legends, axes, strips, etc.

    grid.newpage()
    grid.draw(ggarrange(plots=list(p1,  p4, p2, p3), widths = c(2,1), debug=TRUE))
    

提交回复
热议问题