On 10/5/06, Osman Al-Radi <[EMAIL PROTECTED]> wrote: > Hi, > > for the data below: > time<-c(rep(1:10,5)) > y<-time+rnorm(50,5,2) > subject<-c(rep('a',10),rep('b',10),rep('c',10),rep('d',10),rep('e',10)) > group<-c(rep('A',30),rep('B',20)) > df<-data.frame(subject,group,time,y) > > I'd like to produce a plot with a single pannel with two loess curves one > for each group. the code below does that but on two different pannels, I'd > like to have both curves on the same pannel with different colors. > > xyplot(y~time|group, groups=subject, > panel=function(...){ > panel.loess(...) > } > ,data=df)
Well, the "fix" for your code is xyplot(y ~ time | group, data = df, groups = subject, panel = panel.superpose, panel.groups = function(...) panel.loess(...) ) Which, incidentally is effectively equivalent to xyplot(y ~ time | group, data = df, groups = subject, type = "smooth") However, this is not what you describe as your goal. If you want a single smooth for each group combining all subjects within that group, use something like xyplot(y ~ time, data = df, groups = group. ... The panel part does not change. -Deepayan ______________________________________________ R-help@stat.math.ethz.ch 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.