[R] xyplot (lattice): colours of lines

Umberto Maggiore umberto_maggiore at hotmail.com
Thu Feb 5 12:31:59 CET 2004


using either one of the following codes:

xyplot(X ~ time | center, type="l", panel=panel.superpose, groups=subject, 
col = treatment)

xyplot(X ~ time | center, groups = subject,
  panel = function(x, y, ...){
    panel.superpose(x, y, col = treatment, type = "l", ...)
    })

I get two different colours for the lines by these colours do not match the 
corresponding
treatment variable

Umberto


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?
Umberto

_________________________________________________________________

______________________________________________
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





xyplot(X ~ time | center, type="l", panel=panel.superpose, groups=subject, 
col = treatment)

might work, or more explicitely:

xyplot(X ~ time | center, groups = subject,
  panel = function(x, y, ...){
    panel.superpose(x, y, col = treatment, type = "l", ...)
    })

Best,

Renaud

_________________________________________________________________




More information about the R-help mailing list