How do I print greek letters on the diagonal of a pairs plot in R?

前端 未结 1 1441
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-13 00:53

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 <

相关标签:
1条回答
  • 2021-01-13 01:23

    expression(lab) doesn't actually evaluate lab so you end up with all the labels being lab. Instead, you could change that line to:

    text(0.5, 0.5, parse(text=lab), cex=cex, font=font)
    

    which will do what you want. Note that the pairs function also accepts a labels argument, so this would work too:

    pairs(dat, labels=c(expression(alpha), expression(beta), expression(gamma)))
    
    0 讨论(0)
提交回复
热议问题