[R] pairs correlations colors

Valeria Edefonti valeria.edefonti at uni-bocconi.it
Wed Sep 15 01:40:39 CEST 2004

I have the following problem.
I want to use pairs function and get a matrix of scatterplots with the  
correlations in the upper panel and the ordinary scatterplots in the  
lower panel.
Moreover, I want to have points colored in five differet ways in the  
lower panel, because I have five subgroups.
In order to do that I tried to combine examples on pairs function help.
I got a colored matrix using hints on iris dataset.
I got a black and white matrix with correlations using function  
panel.cor, exactly as it is in the example.
Unfortunately, the line:

6],labels=c("ALCAM","ITGB5","MSN","CSTB","DHCR24","TRIM29"), main =  
"Scatterplots selected genes",pch=21,
bg = c("red", "green3", "blue",  

doesn't allow me to get the desidered matrix with colors and  
I also tried to create a function panel.col for the lower.panel:

## put colors on the lower panels
      panel.col <- function(datiepheno)
         usr <- par("usr"); on.exit(par(usr))
         par(bg = c("red", "green3", "blue",  
"brown","orange")[datiepheno[,7]],pch=21, usr = c(0, 1, 0, 1))

but it doesn't work as well.
Any idea?
I hope I'll be precise but not too much precise!
Thank you very much

More information about the R-help mailing list