(I have checked the 2000 &2001 archives) Awhile ago, someone posted a function to plot a scatterplot matrix with the upper triangle containing plots (and maybe fitted curves?) and the lower triangle containing the correlation coefs. I have lost that code and would love it again if anyone has it. Thanks, Henry ***************************** Martin Henry H. Stevens HStevens at muohio.edu tel: (513) 529 - 4206 FAX: (513) 529 - 4243 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Fancy pairs(), scatterplot matrix?
3 messages · Martin Henry H. Stevens, Brian Ripley, Ko-Kang Kevin Wang
On Thu, 26 Jul 2001, Martin Henry H. Stevens wrote:
(I have checked the 2000 &2001 archives) Awhile ago, someone posted a function to plot a scatterplot matrix with the upper triangle containing plots (and maybe fitted curves?) and the lower triangle containing the correlation coefs. I have lost that code and would love it again if anyone has it. Thanks,
Look at ?pairs for the example (which in fact had upper and lower interchanged). It was by Dr. Jens Oehlschlaegel-Akiyoshi. That is, provided I have the right example in mind.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I believe that you can find it by typing ?pairs in R, this is how I found it. But anyway, here it is:
panel.cor <- function(x, y, digits=2, prefix="", cex.cor) {
usr <- par("usr"); on.exit(par(usr))
par(usr = c(0, 1, 0, 1))
r <- abs(cor(x, y))
txt <- format(c(r, 0.123456789), digits=digits)[1]
txt <- paste(prefix, txt, sep="")
if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
text(0.5, 0.5, txt, cex = cex * r)
}
pairs( sport[c(1, 3:8 )], main = "Australian Institute of Sport Data - with Correlations",
upper.panel=panel.smooth, lower.panel=panel.cor )
The panel.cor basically is the correlation function, which will be place in the "lower.panel" - a parameter in the pairs() function. The upper.panel can be set to panel.smooth, which will have a smoothly fitted line in your plots. You will need to put your dataset names in the place of sport though, as this is a case I just did which I copied the lines and pasted here.
Cheers,
Kevin
--------------------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Head of Statistical Analysis Division
Software Developers' Klub (SDK)
University of Auckland
New Zealand
-----Original Message-----
From: owner-r-help at stat.math.ethz.ch [mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Martin Henry H. Stevens
Sent: Friday, July 27, 2001 6:23 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Fancy pairs(), scatterplot matrix?
(I have checked the 2000 &2001 archives)
Awhile ago, someone posted a function to plot a scatterplot matrix with the
upper triangle containing plots (and maybe fitted curves?) and the lower
triangle containing the correlation coefs. I have lost that code and would
love it again if anyone has it. Thanks,
Henry
*****************************
Martin Henry H. Stevens
HStevens at muohio.edu
tel: (513) 529 - 4206
FAX: (513) 529 - 4243
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._