Search code examples
rheatmappsych

Displaying the numbers in an R correlation matrix diagonally


I am generating a correlation matrix using

library(psych)
corMat = cor(data)
cor.plot(corMat,numbers=TRUE,colors=TRUE,n=51,main=NULL,labels=NULL)

but want to alter it so that the numbers displayed inside the heatmap are displayed diagonally.


Solution

  • I may have misunderstood but if you just want the text labels rotated, you can do so by changing the source of cor.plot, specifically the line text(rx, ry, round(r * 100)) to text(rx, ry, round(r * 100), srt=45), giving something like this: enter image description here