Dear list,

I've been trying this for a few hours and I just don't understand how lattice works with groups and subscripts.

Consider the following example,



xx <- seq(1, 10, length=100)
x <- rep(xx, 4)
y <- c(cos(xx), sin(xx), xx, xx^2/10)
fact <- factor(rep(c("cos", "sin", "id", "square"), each=100))
fact2 <- factor(rep(c("periodic", "not periodic"), each=100))

my.df <- data.frame(x=x, y=y, fact = fact, fact2 = fact2)

head(my.df)


myColors <- c(2, 4)

        xyplot(y ~ x | fact,  data = my.df, groups = fact2,
              panel =  panel.superpose,
              panel.groups = function(..., group.number) {

                 panel.xyplot(...)
                        #panel.xyplot( ..., col=myColors[group.number]) # error
        
              })


My aim is to assign a custom color to each group, but for some reason the col parameter is already given to panel.xyplot and I can't find where it gets the values from.

Many thanks,

baptiste

_____________________________

Baptiste AuguiƩ

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

______________________________________________
R-help@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.

Reply via email to