I am plotting correlation plot with corrplot. I want to plot also the correlation coefficients:
require(corrplot)
test <- matrix(data = rnorm(400), nrow=20, ncol=20)
corrplot(cor(test), method = "color", addCoef.col="grey", order = "AOE")
But they are too big in the plot:
Is there any way to make the font of the coefficent smaller? I've been looking at ?corrplot
but there are only parameters to change the legend and axis font sizes (cl.cex
and tl.cex
). pch.cex
doesn't work either.
I had exactly the same problem a little while ago when I had to do a corrplot similar to yours. After a lot of searching I found a solution which involves printing the correlation plot to a png file and altering the parameters there.
i.e.:
The part that increases/decreases the font inside the cells is parameter pointsize. setting it to 15 you can see that the numbers now fit the cells.
You may also find this link helpful. it certainly helped me.
It is far from the answer, it is kind of a dirty hack, but this works (thanks user20650 for the idea):
Just come across this problem myself and all the commands to use with corrplot are here: https://cran.r-project.org/web/packages/corrplot/corrplot.pdf
Including (as someone said) number.cex for the correlation number but also tl.cex for the central text label. I am guessing they have updated the package and the support docs since the last answers!
The option to use is
number.cex=
. As incorrplot(cor(test), method = "color", addCoef.col="grey", order = "AOE",number.cex=0.75)
.To make it dynamic, try
number.cex= 7/ncol(Df)
whereDf
is dataframe for which the correlation was run.I would define my own size value since the function just ommited allowing for a size to be added to that text. Below is the function recreated with an extra number.cex paramater added at the end, which controls the number label size now.