make one panel blank in ggplot2

前端 未结 2 944
谎友^
谎友^ 2021-01-05 09:46
p <- ggplot(mtcars, aes(mpg, wt)) 
p + geom_point()+facet_grid(cyl ~ vs)+theme_bw()

\"Pic\"

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-05 10:30

    You can do that, but not with facet_wrap (as far as I know). Create your seperate sub-plots. For a detailed step by step approach, see my answer here.

    Create a blank plot & with the package gridExtra you can combine the plots:

    library(gridExtra)
    library(grid)
    
    blank <- grid.rect(gp=gpar(col="white"))
    
    grid.arrange(plot1, plot2, blank, plot3, ncol=2)
    

    This approach will give you also a lot influence on the appearance of you final plot (IMHO).

提交回复
热议问题