[R] Colors on box plots in ggplot

David Doyle kyd@v|ddoy|e @end|ng |rom gm@||@com
Thu Jan 17 23:32:51 CET 2019


Hello,

I'm trying to set different boxes to different colors the following page
shows
http://www.sthda.com/english/wiki/ggplot2-box-plot-quick-start-guide-r-software-and-data-visualization


I've tried the code
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
head(ToothGrowth)
library(ggplot2)
# Basic box plot
p <- ggplot(ToothGrowth, aes(x=dose, y=len))  +
  geom_boxplot()
p+scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))
p

But still can not get the colors to show up.  I'm sure it is something
simple I'm doing wrong and would appreciate help.

Thank you in advance
David

	[[alternative HTML version deleted]]



More information about the R-help mailing list