Adding x and y laxis label to ggplot-grid build with cowplot

后端 未结 2 651
情书的邮戳
情书的邮戳 2021-01-16 10:33

I produced a grid with cowplot:

library(ggplot2)
library(cowplot)

ggg1 <- ggplot(mtcars, aes(mpg,vs)) + geom_point() +
  theme(axis.title.x=element_blank         


        
2条回答
  •  耶瑟儿~
    2021-01-16 11:30

    This seems to work...

    plot_grid(plot_grid(ggg1, ggg2, labels=c("", ""), ncol = 1), 
              ggg3, 
              labels=c("", ""), 
              ncol =2,  
              scale=0.9) + #perhaps reduce this for a bit more space
    draw_label("xlab", x=0.5, y=  0, vjust=-0.5, angle= 0) +
    draw_label("ylab", x=  0, y=0.5, vjust= 1.5, angle=90)
    

提交回复
热议问题