Align multiple ggplot2 plots with grid

后端 未结 3 1599
情歌与酒
情歌与酒 2020-12-01 18:49

Context

I want to plot two ggplot2 on the same page with the same legend. http://code.google.com/p/gridextra/wiki/arrangeGrob discribes, how to do this. This alrea

3条回答
  •  被撕碎了的回忆
    2020-12-01 19:18

    1. Using cowplot package:

    library(cowplot)
    plot_grid(p1, p2, ncol=1, align="v")
    


    2. Using tracks from ggbio package:

    Note: There seems to be a bug, x ticks do not align. (tested on 17/03/2016, ggbio_1.18.5)

    library(ggbio)
    tracks(data1=p1,data2=p2)
    

    enter image description here

提交回复
热议问题