我想从ggplot
2路facet_grid
中删除整个面板。我从this问题中得到了一些线索。下面是带有示例数据的代码
library(ggplot2)
library(ggh4x)
df <- data.frame(x=rnorm(80),y=rnorm(80),
col=rep(c(" ", "B","C"," ","B","C","B","C"),each=10),
row=rep(c("a","a","a","b","b","b","c","c"),each=10))
ggplot(data=df,aes(x=x,y=y))+
geom_point()+
facet_grid2(row~col, scales = "free", independent = "all")
我想拆下左边的嵌板。如何才能做到这一点?
2条答案
按热度按时间3ks5zfa01#
从您的评论中注意到,预先设置数据集的子集不是您的选择,因此这里有一个后期制作方法:
数据:
esyap4oy2#
一种方法是使用
subset()
: