I would like to colorize the dots in each panel based on the z value. The code I currently have does not distinguish the z value from each panel. I understand that I need a panel function and a panel. Maybe this will help, but I'm lost.
x <- c(1:10, 1:10) y <- c(10:1, 10:1) z <- c(1:10, seq(1,20, by=2)) a = c(rep("one",10),rep("two",10)) xyplot(y ~ x |a, panel=function(x,y, ...) { panel.xyplot(x,y, pch=20, cex=0.3, col = ifelse(z < 5, "red", "black")) } )
The correct plot will have only two points: two points in the two panel.
source share