I am using qplot to create a stacked bar plot and would like to place a white line between the sections of each bar as the blues seem to almost blend together. I do not want to change my existing colour scheme to resolve the problem. Any ideas?
library(ggplot2)
qplot(carat, data = diamonds, geom = "histogram", fill = color)
Add the argument colour="white"
to create a white outline:
ggplot(mtcars, aes(factor(cyl), fill=am, group=am)) + geom_bar(colour="white")
Here is a workaround to remove the diagonal line from the legend (inspired by a posting on ggplot mailing list ). The idea is to plot the geom_bar
twice, once suppressing the colours:
ggplot(mtcars, aes(factor(cyl), fill=am, group=am)) +
geom_bar() +
geom_bar(colour="white", show_guide=FALSE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.