[英]How to remove grey borders around individual entries in ggplot2 legend when using theme_bw?
I have the following code in R: 我在R中有以下代码:
library(ggplot2)
theme_set(theme_bw())
p <- ggplot(mtcars, aes(wt, mpg))
p <- p + geom_point(aes(colour = factor(cyl)))
p
Resulting in this: 结果如下:
Each legend entry has a grey border around it. 每个图例条目都有一个灰色边框。 How to remove it? 如何删除它?
Just add 只需添加
+ theme(legend.key = element_rect(colour = NA))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.