Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R corrplot colors range

Tags:

plot

r

r-corrplot

I am using corrplot in R to plot a correlation-coefficient matrix, but my correlations range only from 0.95 to 1.00, and I don't know how to set the lower and upper bounds of colors palette.

corrplot(segCorr, order = "hclust", tl.cex = .6, 
         cl.lim = c(0.95, 1), col=colorRampPalette(c("blue","white","red"))(10))

Despite of the settings everything is in one color, but I need to see these small differences in details.

like image 846
Peter.k Avatar asked Nov 06 '16 16:11

Peter.k


1 Answers

A "hack" I sometimes use, to avoid spending too much time setting a good color-pallete, is to set is.corr = FALSE. Then we get from

with(mtcars, corrplot(cor(cbind(disp, hp, cyl)), cl.lim = c(0.7, 1)))

enter image description here

to...

with(mtcars, corrplot(cor(cbind(disp, hp, cyl)), cl.lim = c(0.7, 1), is.corr = FALSE))

enter image description here

like image 69
J.R. Avatar answered Oct 02 '22 20:10

J.R.