Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Corrplot square (tile) size

Tags:

r

r-corrplot

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))
like image 708
bashmike Avatar asked Jul 27 '26 22:07

bashmike


1 Answers

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

like image 140
Marco Sandri Avatar answered Jul 29 '26 14:07

Marco Sandri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!