【发布时间】:2015-05-31 22:50:51
【问题描述】:
我希望删除右侧的那些标签,即侧面灰色框上的标签。我举个例子:
p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point()
p + facet_grid(cyl ~ .)
提前致谢!
胡安
【问题讨论】:
标签: r plot ggplot2 label facet
我希望删除右侧的那些标签,即侧面灰色框上的标签。我举个例子:
p <- ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point()
p + facet_grid(cyl ~ .)
提前致谢!
胡安
【问题讨论】:
标签: r plot ggplot2 label facet
以下内容会这样做:
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())
【讨论】:
ggplot(mtcars, aes(mpg, wt, col=factor(cyl))) + geom_point() + facet_grid(cyl ~ .) + theme(strip.text.y = element_blank(), strip.background = element_blank())
ggplot(economics_long, aes(date, value)) + geom_line() + facet_wrap(~variable, scales = "free_y", nrow = 2) + theme(strip.background = element_blank(), strip.text.y = element_blank())