Skip to content
Prev 206541 / 398503 Next

Lattice: How to color the data points in splom() according to the panel they are plotted?

Marius Hofert wrote:
I think that you will have to modify panel.pairs to get what
you want. But I must admit that I can't see why you would
want such a plot. What's achieved by having different
colours in different subpanels? And you would lose the
ability to colour groups differently (or things would become
really complicated and messy).

Attached is a modified panel.pairs function (but don't let
Deepayan see it; he'll probably be horrified by the
kludginess). Source the file and then try:

splom(~iris[1:3], superpanel = mypanel.pairs,
   clrmat = matrix(1:9,3,3))
splom(~iris[1:3], superpanel = mypanel.pairs,
   clrmat = matrix(c(NA,1,1,2,NA,4,2,6,NA),3,3))
theclrs <- matrix(c(NA,1,1,1,2,NA,3,3,2,4,NA,4,2,5,5,NA),4,4)
splom(~iris[1:4], superpanel = mypanel.pairs,
   clrmat = theclrs)

  -Peter Ehlers