[R] Add color to Boxplot by value

2012-01-12 Thread KWyshak
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

Re: [R] Add color to Boxplot by value

2012-01-12 Thread Justin Haynes
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'))