Read ?panel.superpose carefully and pay attention to the comments about the group.number argument passed to panel.groups. You can test the value of this argument and adjust the plot accordingly.
Bert Gunter Genentech Nonclinical Statistics 7-7374 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, November 30, 2007 8:50 AM To: r-help@r-project.org Subject: [R] Set panel background color in a multi-group trellis plot Hi everyone, I am trying to change some of the default colors in a multipanel-multigroup lattice graphic, but when I change the panel color to white, the only group that is plotted is the last one, as panel.fill overwrites all the previous ones. Is there any way to set the panel background color for the first panel to a color and keep the rest transparent? My code looks like this: #first set defaults for getting more distinct symbols superp.symbol <- trellis.par.get("superpose.symbol") superp.symbol$pch = 15:21 superp.symbol$cex = 1.5 trellis.par.set("superpose.symbol", superp.symbol) #set the default for the colors in the symbols superp.lines <- trellis.par.get("superpose.line") superp.lines$lty <- 1:6 superp.lines$lwd <- 1.5 trellis.par.set("superpose.line", superp.lines) #set the device color to lightblue trellis.par.set("background", list(col = "lightblue")) xyplot(Volume ~ Age|Farm, groups = Treatment, data = my_data, panel = panel.superpose, panel.groups = function(x,y, ...) { panel.fill(col = "white") panel.grid(col = "gray",lty = 2) panel.xyplot(x,y,...) } ,auto.key = list(location = "bottom"), main = "Main effects") If I try to do something like if (panel.group == 1) panel.fill(col = "white") I get an error saying panel.group doesn't exist. Any thoughts? Regards, Cristián Montes NC State University ______________________________________________ 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. ______________________________________________ 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.