Skip to content

losing color in panal.xyplot (lattice)

1 message · Frank

#
Dear R help-list reader,

I have a grouping variable C<-c(1,2,3) which gives me the plot 
symbols in a xyplot (lattice library) in three different colors, 
according the group variable.

xyplot(A ~ B), group=factor(C))

if I now apply the panel.xyplot / panel.loess all the colors are 
changing back to red.

xyplot(A ~ B), group=factor(C)),
panel = function(x, y) {
            panel.grid(h=-1, v= 2)
            panel.xyplot(x, y)
            panel.loess(x,y, span=1)
        },
aspect = "xy")

I'm wondering if anyone knows a easy way how I could retain the 
colors of the plot symbols according to the grouping variable.

Yours
Frank