Hi,


I am using ggplot and geom_violin to build a violin plot of some with only 2 
categories. All is good except that I cannot set up the colors I want or the 
violin plots. Either I have same color for both my categories or colors from 
probably rainbow(2), which are red and blue. What if I want brown and 
forestgreen. How do I do it?



so my code follows:

 
p <- ggplot(x1, aes(Location, aer_m_GPS , fill=factor(Location), 
colour=factor(Location)))


p1 <- p+geom_violin(alpha=0.3, width=1, trim = FALSE, scale = "width", adjust = 
0.5) + geom_boxplot(width=0.2, outlier.colour="red", notch = FALSE, notchwidth 
= .5, alpha = 0.5, colour = "grey50")


p1



This will plot the violin plot with boxplot superimposed on it, both with color 
red and blue. I hope to get brown and forestgreen.


Thanks for any advice,


Monica                                    
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to