r - ggplot2: geom_bar stacked barplot, specify bar outline color -



r - ggplot2: geom_bar stacked barplot, specify bar outline color -

i trying figure out how specify outline color on stacked barplot in ggplot2. in below code specify color="green", gives greenish outline each of bars. specify different outline color each bar (e.g. cut=fair filled yellowish , outlined orange, cut=good filled lite greenish , outlined dark green, etc.).

ggplot(diamonds) + geom_bar(aes(clarity, fill=cut))+ scale_fill_manual(values=c("fair"="yellow","good"="light green","very good"="light blue","premium"="pink","ideal"="purple"))+

i have tried scale_color_manual() , specifying vector of colors in geom_bar() aesthetics, neither have worked.

you must map both aesthetics cut variable, , can utilize scale_colour_manual. here (ugly) example:

ggplot(diamonds) + geom_bar(aes(clarity, fill=cut, colour=cut)) + scale_colour_manual(values=c("fair"="brown", "good"="blue", "very good"="green", "premium"="red", "ideal"="yellow")) + scale_fill_manual(values=c("fair"="yellow", "good"="light green", "very good"="light blue", "premium"="pink", "ideal"="purple"))

r ggplot2 geom-bar

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -