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


I am trying to figure out how to specify the outline color on a stacked barplot in ggplot2. In the code below I specify color = "green" which gives a green outline for each time, I would like to specify a different outline color for each bar (like cut = fair will be filled with yellow and outlined with orange, cut = good will be light green and underlined with dark green, etc.).

  ggplot (diamond) + geom_bar (AES (clarity, fill = cut)) + scale_fill_manual (values ​​= c ("fair" = "yellow", "good" = "light green I have tried  scale_color_manual ("very good" = "light blue", "premium" = "pink", "ideal" = "purple"))  )  and  geom_bar ()  specify a vector of colors in aesthetics, neither has worked.   

You have to map both the sensations in the cut variable, and then you You can use scale_colour_manual . This is an (ugly) example:

  ggplot (diamond) + geom_bar (AES (clarity, fill = cut, color = cut)) + scale_colour_manual (values ​​= c ("fair" = "Brown", "good" = "blue", "very good" = "green", "premium" = "red", "ideal" = "yellow")) + scale_fil_manual (values ​​= c ("fair "=" Yellow "," good "=" light green "," very good "=" light blue "," premium "=" pink "," ideal "=" purple "))   

Enter image details here

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -