[英]How to remove grey borders around individual entries in ggplot2 legend when using theme_bw?
我在R中有以下代碼:
library(ggplot2)
theme_set(theme_bw())
p <- ggplot(mtcars, aes(wt, mpg))
p <- p + geom_point(aes(colour = factor(cyl)))
p
結果如下:
每個圖例條目都有一個灰色邊框。 如何刪除它?
只需添加
+ theme(legend.key = element_rect(colour = NA))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.