Search code examples
rmatrixr-corrplot

Set the background color as the intensity of data in corrplot


I have a matrix of data and I want to use the background color to show the value of the element of the matrix so the darker the background the bigger the matrix element. I have used corrplot like this:

corrplot(overlaps[[1]], method="number", is.corr=FALSE, type="full",
         cl.lim=c(0,100), addgrid.col="red", addshade="positive")

and the matrix would be like below: enter image description here

But I want the background to show the intensity not the numbers as here. What should I do?

Thank you in advance


Solution

  • library(corrplot)
    m <- matrix(rnorm(1000), ncol = 10)
    corrplot(cor(m), method = "color", type="full", addgrid.col = "red",
            addshade = "positive", addCoef.col = "black")
    

    Although I'm not sure if this is the best way to display correlations...