taiyun / corrplot

A visual exploratory tool on correlation matrix
https://github.com/taiyun/corrplot
Other
318 stars 86 forks source link

Corrplot with all correlations printed and no-color for not significant ones #226

Closed mzachariou closed 3 years ago

mzachariou commented 3 years ago

Hi there,

Using the following code with the previous versiou would generate a colored corrplot with all correlations printed and colors only for the significant ones (see attached). The same code in 0.9 version removes the correlation values for the not significant ones. How can I edit the code to generate plots as before?

corrplot(M, method="color", col=col_def(200), addgrid.col = "grey", addCoef.col = "black", # Add coefficient of correlation tl.col="black", tl.srt=45, #Text label color and rotation

Combine with significance

     p.mat = p.mat1, sig.level = p_thr, insig = "blank",
     # hide correlation coefficient on the principal diagonal
     diag=FALSE 

)

Many thanks

Margarita. test.pdf

taiyun commented 3 years ago

Here are two examples.

M = cor(mtcars)
testRes = cor.mtest(mtcars, conf.level = 0.95)

## leave blank on no significant coefficient
## add significant correlation coefficients
corrplot(M, p.mat = testRes$p, method = 'circle', type = 'lower', insig='blank',
         addCoef.col ='black', number.cex = 0.8, order = 'AOE', diag=FALSE)

## leave blank on no significant coefficient
## add all correlation coefficients
corrplot(M, p.mat = testRes$p, method = 'circle', type = 'lower', insig='blank',
         order = 'AOE', diag=FALSE)$corrPos -> p1
text(p1$x, p1$y, round(p1$corr,2), cex=0.8)
mzachariou commented 3 years ago

Many thanks!