Arrange common plot width with facetted ggplot 2.0.0 & gridExtra

后端 未结 4 1272
余生分开走
余生分开走 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:54

    This is ugly but if you're under a time pressure this hack will work (not generalizable and dependent upon plot window size). Basically make the top plot 2 columns with a blank plot on the right and guess at the widths.

    grid.arrange(
        grid.arrange(plot.iris, ggplot() + theme_minimal(),ncol=2, widths = c(.9, .1)),
        plot.mpg, 
        ncol=1
    )
    

提交回复
热议问题