Search code examples
rr-corrplot

R Corrplot square (tile) size


I'm plotting a correlation plot with 10 variables using method="number." I'm trying to export the plot with large font sizes (number.cex = 3, tl.cex = 3) for publication purposes, but the squares do not increase in size to accommodate the larger fonts. Is there a way to modify this?

This is my code if it helps:

corrplot(as.matrix(K), tl.cex = 3, tl.col = "black", method = "color", 
         outline = T,  order="hclust", 
         addCoef.col = "black", number.digits = 2, number.cex = 3, 
         cl.pos = 'b', cl.cex = 3, addrect = 3, rect.lwd = 3, 
         col = colorRampPalette(c("midnightblue", "white","darkred"))(100))

Solution

  • You should tune the width, height and res parameters of your graphic output file.
    See an example below.

    set.seed(1)
    X = matrix(runif(1000),ncol=10)
    library(corrplot)
    png(file="corr.png", res=300, width=4500, height=4500)
    corrplot(as.matrix(cor(X)), tl.cex = 3, tl.col = "black", method = "color", 
             outline = T,  order="hclust", 
             addCoef.col = "black", number.digits = 2, number.cex = 3, 
             cl.pos = 'b', cl.cex = 3, addrect = 3, rect.lwd = 3, 
             col = colorRampPalette(c("midnightblue", "white","darkred"))(100))
    dev.off()
    

    enter image description here