Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font size of the correlation coefficient in corrplot?

Tags:

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:

enter image description here

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.

like image 789
Tomas Avatar asked Oct 26 '14 14:10

Tomas


People also ask

How do you change the size of a Corrplot?

The correlation coefficient value size in correlation matrix plot created by using corrplot function ranges from 0 to 1, 0 referring to the smallest and 1 referring to the largest, by default it is 1. To change this size, we need to use number. cex argument.

How do I change the font size in R code?

Go to the menu in RStudio and click on Tools and then Global Options. Select the Appearance tab on the left. Again buried in the middle of things is the font size. Change this to 14 or 16 to start with and see what it looks like.

How do I increase font size in R studio?

Then, you can further adjust the font of code window, console, terminal, environment, and history panels via Tools >> Global Options >> Appearance >> Editor font size.

What type of correlation does Corrplot use?

R package corrplot provides a visual exploratory tool on correlation matrix that supports automatic variable reordering to help detect hidden patterns among variables. corrplot is very easy to use and provides a rich array of plotting options in visualization method, graphic layout, color, legend, text labels, etc.


1 Answers

The option to use is number.cex=. As in the following:

corrplot(cor(test),    method = "color",     addCoef.col="grey",     order = "AOE",     number.cex=0.75) 

To make it dynamic, try number.cex= 7/ncol(df) where df is dataframe for which the correlation was run.

like image 142
skoh Avatar answered Oct 02 '22 10:10

skoh