how bout:
dat<-data.frame(val=rnorm(100,12,10),x=letters[1:4])
col.val<-ddply(dat,.(x),summarise,mean(val))
col.val$breaks<-cut(col.val$..1,c(0,9,15,Inf))
dat.merge<-merge(dat,col.val)
ggplot(dat.merge,aes(x=x,y=val,colour=breaks))+geom_boxplot()+scale_color_manual(values=c('green','yellow','red'))
On Thu, Jan 12, 2012 at 7:45 AM, KWyshak <kwyshak@illumina.com> wrote:
> I have a boxplot of Production run rates per 10 minute intervals and I
> would
> like to color code them by the average (i.e. >15ppm = green, <9ppm =
red,
> everything else yellow).
>
> Is there a way to do this?
>
> http://r.789695.n4.nabble.com/file/n4289381/RunRateBoxWhisker.png
>
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/Add-color-to-Boxplot-by-value-tp4289381p4289381.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
[[alternative HTML version deleted]]