How to align an ordinary ggplot with a faceted one in cowplot?

后端 未结 5 394
南方客
南方客 2020-12-24 13:40

I\'m trying to arrange plots for publication with the use of cowplot package.
I just want the panels to be equally sized and labelled.

Reproducibl

5条回答
  •  -上瘾入骨i
    2020-12-24 14:24

    Update: egg package is on CRAN now
    https://cran.r-project.org/web/packages/egg/index.html


    I just want to add that @baptiste has created a great experimental package egg, which accomplishes what he wrote in his answer:

    Install it from github (https://github.com/baptiste/egg)

    library("devtools")
    install_github("baptiste/egg")
    

    Then simply do

    library("egg")
    ggarrange(gg1, gg2, ncol=2)
    

    You can add labels manually:

    ap <- ggarrange(gg1,gg2, ncol=2)
    ggdraw(ap) + draw_plot_label(label=c("a","b"), x=c(0,0.5), y=c(1,1))
    

    (When I tried to first add the labels to the individual plots, the plots didn't get arranged properly.)

提交回复
热议问题