Left align two graph edges (ggplot)

前端 未结 9 1279
梦谈多话
梦谈多话 2020-11-22 01:08

I\'m using ggplot and have two graphs that I want to display on top of each other. I used grid.arrange from gridExtra to stack them. The problem is I want the

9条回答
  •  北海茫月
    2020-11-22 01:37

    Using cowplot package:

    A <- ggplot(CO2, aes(x=Plant)) + geom_bar() +coord_flip() 
    B <- ggplot(CO2, aes(x=Type)) + geom_bar() +coord_flip() 
    
    library(cowplot)
    plot_grid(A, B, ncol=1, align="v")
    

提交回复
热议问题