Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

corrplot parameters in R

Tags:

plot

r

r-corrplot

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

like image 723
hora Avatar asked Feb 07 '13 14:02

hora


People also ask

What does a Corrplot show?

R package corrplot provides a visual exploratory tool on correlation matrix that supports automatic variable reordering to help detect hidden patterns among variables. corrplot is very easy to use and provides a rich array of plotting options in visualization method, graphic layout, color, legend, text labels, etc.

How do I change colors in Corrplot?

To change the color code of corrplot, we can use colorRampPalette function inside corrplot function. We can provide different colors in colorRampPalette that we want to display in the corrplot.

Why are there question marks in my Corrplot?

The question marks denote that correlation is not defined in the given case due to insufficient amount of data.


1 Answers

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()
like image 188
Arun Avatar answered Sep 27 '22 19:09

Arun