Dear all,

I want to draw a graph that contains the scatterplot matrix in the lower panel 
and coefficients in the upper panel. I used and adapted the example for the 
function pairs but cannot figure out how to get no values and ticks in the 
upper panel (the values should only be in the lower panel). The upper panel 
looks odd to me this way. Any hints?

Thanks in advance
Steffen


Here is an example what the graph looks like:
#############################################
data(mtcars)
panel.cor <- function(a, b, digits=2,  ...)
     {
         
        usr <- par("usr"); on.exit(par(usr))
         par(usr = c(0, 1, 0, 1))
         x<-cbind(a,b)
         x<-na.omit(x)
         n <- nrow(x)
         pp <- c(0.025, 0.975)
         corx <- cor(x,method="s")[1, 2]
         CI<-c(tanh(atanh(corx) + qnorm(pp)/sqrt((n - 3)/1.06)))
         txt1 <- paste("rho =",format(c(corx, 0.123456789), digits=digits)[1])
         txt2<-paste("(",format(c(CI,0.123456789)[1],digits=digits),"; 
",format(c(CI,0.123456789)[2],digits=digits),")",sep="")
         txt3<-paste("N =",round(n,0))
         txt <- paste(txt1,"\n","95%KI ",txt2,"\n",txt3, sep="")
         text(0.5, 0.5, txt,cex=.8)
     }
         
diag.cor<-function(a,b, ...)
    {
        usr <- par("usr"); on.exit(par(usr))
        par(usr = c(0, 1, 0,1))
        rect(0,0,1,1,col="grey")
     }

pairs(mtcars[1:4],upper.panel=panel.cor,diag.panel=diag.cor,label.pos=0.5)
#############################################

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to