0
这里是一个重复的例子,ggplot2:如何只在一个方面删除一个级别?
set.seed(12)
d = data.frame(
x = rep(LETTERS[c(2,1,3,4)],each=30),
y=rnorm(120),
facet = c(rep("facet 1", 20), rep("facet 3", 10), rep(rep(paste("facet",1:3), each=10),3))
)
require(ggplot2)
ggplot(d,aes(x=x,y=y)) + geom_boxplot() + facet_grid(.~facet)
正如你所看到的,在facet 2
,对于x == "B"
没有条目。
如何删除空白并仅为facet 2
选择B
?
然后facet 2
的横向宽度将是其他方面的3/4。