摆脱那些灰色框上的facet_grid标签?

时间:2015-03-27 14:52:04

标签: r plot ggplot2 label facet

我希望删除右侧的标签,侧面灰色框上的标签。我举一个例子:

p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point()
p + facet_grid(cyl ~ .)

enter image description here

提前致谢!

1 个答案:

答案 0 :(得分:30)

以下会这样做:

p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point()
p <- p + facet_grid(cyl ~ .)
p <- p +theme(strip.text.y = element_blank())

没有矩形

p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point()
p <- p + facet_grid(cyl ~ .)
p <- p + theme(strip.background = element_blank(),
   strip.text.y = element_blank())

enter image description here