[R] Legend colors not matching with Intxplot line colors

arun smartpink111 at yahoo.com
Mon Jun 4 02:40:58 CEST 2012


Dear R help,

I am using intxplot() from the library(HH).  I have a dataset with 12 treatment groups.  At first, I tried intxplot with no color settings.  Then, the legend color was matching with the plot line colors, but some of the colors were repeated.  So, I set the colors using par.settings.  Now, I have the plot lines with different colors, but it seemed to be not matching with legend color.  Legend colors are repeated.  I am pasting below sample dataset with codes.

set.seed(1)
dat1<-rnorm(120,0.5,0.2)
dat2<-data.frame(time=rep(c(1:20),rep(12,20)),trt=rep(LETTERS[1:12],each=1))
dat3<-data.frame(dat2,dat1)
colnames(dat3)<-c(names(dat2),"Response")
dat3<-transform(dat3,trt=ordered(trt,levels=LETTERS[1:12]))    
dat3$time<-factor(dat3$time)
position(dat3$time)<-as.numeric(levels(dat3$time))

library(HH)
par.settings<-simpleTheme(col=c(8,12,28,36,41,47,81,92,98,113,125,155))
intxplot(Response ~ time, data = dat3, groups = trt, ylim=c(0,1), par.settings=par.settings, main=" Response")

Any help will be appreciated.

Thanks,
A.K.



More information about the R-help mailing list