[R] xyplot (lattice): colours of lines

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Feb 5 22:08:49 CET 2004


I would need a real example to figure this out. Could you send me your data as 
an rda file (saved using save() and your code ? (No guarantees as to how fast 
I can reply, though. I'm somewhat busy with other things.)

On Thursday 05 February 2004 01:52 pm, Umberto Maggiore wrote:
> It works. However, now I get another odd result: in some plots there are
> straight lines connecting the end of a line with the beginning of another
> one.
>
> On Wednesday 04 February 2004 04:03, Umberto Maggiore wrote:
> >Using data from a multicenter study with a parallel-group design comparing
> >two treatments, I plotted each subject's time change of X after
> > stratifying for center:
> >
> >xyplot(X ~ time | center, type="l", panel=panel.superpose, groups=subject)
> >
> >Now I want these lines to take different colours according to the variable
> >"treatment". Any help?
>
> Umm, you should already have lines colored differently by different
> 'subject's. Do you want to further differentiate by treatment ?
>
> If that's so, there's probably no good way. You could try creating a new
> factor combining subject and treatment and use that as the groups argument,
> e.g.,
>
> factor(paste(as.character(subject), as.character(treatment), sep = "/"))
>
> Deepayan
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list