Marius Hofert
2012-Jan-21 17:50 UTC
[R] Fwd: How to access the panel rows/columns in pairs()?
okay, I found something. Not very elegant, but it does the job:
## generate data
U <- matrix(runif(4000), ncol=4)
## define panel function for colorizing the panels
cols <- c("blue", "black", "black",
"blue", "black", "black",
"black", "black", "green",
"black", "black", "green")
count <- 0
mypanel <- function(x, y, ...){
count <<- count + 1
print(count)
points(x, y, cex=0.5, col=cols[count])
}
## scatter plot matrix
pairs(U, panel=mypanel)