Hello,

I'd like to add custom labels to my pair() plot. These
labels include math expression but they aren't correctly
displayed...

Further, I want that the boxes for the text.panel (diagonal)
have an other background color (grey80). Is that generally 
possible? If yes how do I have to set it?

What I've so far 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.5/strwidth(txt)
        
        test <- cor.test(x,y)
        # borrowed from printCoefmat
        Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
                        cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
                        symbols = c("***", "**", "*", ".", " "))
        
        text(0.5, 0.5, paste(txt,Signif), cex = 2)
}

#correlation pair plot
pairs(df, labels=c(expression(alpha),"text",expression(beta)), 
lower.panel=panel.smooth, upper.panel=panel.cor)


Maybe someone knows how to do that and can give some hints...

/Johannes

--

______________________________________________
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