Hi Richard, Thanks for the solution. A.K.
From: Richard M. Heiberger <rmh at temple.edu>
To: arun <smartpink111 at yahoo.com>
Sent: Monday, June 4, 2012 1:47 AM
Subject: Re: [R] Legend colors not matching with Intxplot line colors
To: arun <smartpink111 at yahoo.com>
Sent: Monday, June 4, 2012 1:47 AM
Subject: Re: [R] Legend colors not matching with Intxplot line colors
Thank you for catching that.? I will repair it in the next version of HH. The problem is that the colors of the key are not automatically detected by intxplot. Here is the workaround: tmp <- intxplot(Response ~ time, data = dat3, groups = trt, ylim=c(0,1), par.settings=par.settings, main=" Response") tmp$legend$right$args$key$lines$col <- par.settings$superpose.line$col tmp On Sun, Jun 3, 2012 at 8:40 PM, arun <smartpink111 at yahoo.com> wrote: 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. > >______________________________________________ >R-help at 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. >??