corrplot parameters in R
Asked Answered
O

2

8

I have used the corrplot as below, but as you can see I need to enlarge the font size of numbers inside the circles and then the plot title is not in a correct position and font size(not visible completely) but I can not find the parameters for them. I will be grateful if you could help.

library(corrplot)

png(height=1200, width=1200, file="overlap.png")

col1 <-rainbow(100, s = 1, v = 1, start = 0, end = 0.9, alpha = 1)
test <- matrix(data=c(20:60),nrow=7,ncol=7)

corrplot(test,tl.cex=3,title="Overlaps Between methods",
  method="circle",is.corr=FALSE,type="full",
  cl.lim=c(10,100),cl.cex=2,addgrid.col="red",
  addshade="positive",col=col1, diag=FALSE,
  addCoef.col = rgb(0,0,0, alpha = 0.6)
)

dev.off()

enter image description here

Otten answered 7/2, 2013 at 14:21 Comment(5)
@Arun, now I think it is reproducible. I need to change the font size of texts inside the circles. But maybe they are proportional to some other parameters.Otten
on my Rstudio, it prints perfectly fine! The problem seems to be with the height= and width= parameter in png. IF you remove it, it gives good results. Even better is with pdf("myfile.pdf").Carnarvon
@Carnarvon even the title? did you use the png and dev.off as well?Otten
check the answer. I think this is what you were looking for..?Carnarvon
For anyone trying to do something similar, cl.lim is now col.lim after version 0.9.0Philadelphia
C
9

The problem seems to be with the png() with the height=1200 and width=1200 options you provide. Try changing that line to:

png(height=1200, width=1200, pointsize=25, file="overlap.png")

The default pointsize = 12 somehow reduces the fonts of the labels and title, for some reason.

Edit: To see the title properly add this parameter to your corrplot:

mar=c(0,0,1,0)

So the entire command set is:

library(corrplot)
png(height=1200, width=1200, pointsize=25, file="overlap.png")
col1 <-rainbow(100, s = 1, v = 1, start = 0, end = 0.9, alpha = 1)
test <- matrix(data=c(20:60),nrow=7,ncol=7)
corrplot(test,tl.cex=3,title="Overlaps Between methods",
method="circle",is.corr=FALSE,type="full",
cl.lim=c(10,100),cl.cex=2,addgrid.col=
"red",addshade="positive",col=col1, addCoef.col = rgb(0,0,0, alpha =
0.6), mar=c(0,0,1,0), diag= FALSE) 
dev.off()
Carnarvon answered 7/2, 2013 at 15:10 Comment(1)
in 2021, pasting the code chunk into R no longer seems to work. The error is null deviceArtie
C
1

Rename parameter cl.lim to col.lim in corrplot() https://cran.r-project.org/web/packages/corrplot/news/news.html

Cecilacecile answered 27/9, 2022 at 4:42 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Finbur

© 2022 - 2024 — McMap. All rights reserved.