[R] How to access the panel rows/columns in pairs()?

Marius Hofert marius.hofert at math.ethz.ch
Sat Jan 21 17:57:10 CET 2012


Hi,

I would like to colorize certain panels in the pairs plot below with certain colors. How can access the panel row and column in a pairs plot to achieve this?

Cheers,

Marius


## generate data
U <- matrix(runif(4000), ncol=4)

## define panel function for colorizing the panels
mypanel <- function(x, y, ...){
    points(x, y, cex=0.5, col="blue") # giving every panel the same color is easy; how can I get different colors for different panels, say, gray for the (2,3)-panel?
}

## scatter plot matrix
pairs(U, panel=mypanel)



More information about the R-help mailing list