当然,只是map color
,就像这样:
library(ggplot2)
ggplot(diamonds) +
geom_bar(aes(clarity, fill = color,
# 1) set the border (i.e. the color aesthetic) based on whether the value
# of the relevant variable (which also happens to be called color) is D
color = color=='D')) +
# 2) use a scale such that FALSE is no color and TRUE is black,
# but don't include this in the legend
scale_color_manual(values = c(NA, 'black'), guide=F)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句