I want to create a pairs plot in R that has labels on the diagonal written as greek letters. I've tried creating a custom text.panel function that wraps the labels in an expression()
call, but this does not work.
Here is a simple test case:
pairs.greek <- function(x, ...)
{
panel.txt <- function(x, y, labels, cex, font, ...)
{
lab <- labels
text(0.5, 0.5, expression(lab), cex=cex, font=font)
}
pairs(x, text.panel=panel.txt)
}
dat <- data.frame(alpha=runif(10), beta=runif(10), gamma=runif(10))
pairs.greek(dat)