Getting rid of facet_grid labels on those gray boxes?

荒凉一梦 提交于 2021-02-06 09:48:29

问题


What I'd like it's to remove those labels on the right side, the ones on gray boxes on the side. I'll give an example:

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

enter image description here

Thanks in advance!

Juan


回答1:


The following would do that:

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

Without rectangles

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



来源:https://stackoverflow.com/questions/29303577/getting-rid-of-facet-grid-labels-on-those-gray-boxes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!