2016-11-06 356 views
2

我在R中使用corrplot绘制相关系数矩阵,但我的相关范围仅从0.95到1.00,我不知道如何设置颜色调色板的下限和上限。R corplot颜色范围

corrplot(segCorr,为了= “hclust”,tl.cex = 0.6, cl.lim = C(0.95,1),山口= colorRampPalette(C( “蓝”, “白”,”红色“))(10))

尽管设置一切都在一种颜色,但我需要看到细节上的细微差异。

+0

http://stackoverflow.com/questions/28109647/r-corrplot-colorlegend-change - 范围似乎有办法......所以尝试'd = mvtnorm :: rmvnorm(50,c(0,0,0),矩阵(c(1,0.9,0.9,0.9,1,0.9,0.9,0.9 ,1),3)); mypal = colorRampPalette(c(“blue”,“white”,“red”))(10); color = rep(mypal,100); corplot(cor(d),order =“hclust”,tl.cex = .6,cl.lim = c(0.85,1),col = color)' – user20650

回答

1

我有时使用“黑客”来避免花费很多时间来设置一个好的颜色盘,那就是设置is.corr = FALSE。然后,我们从

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

enter image description here

得到...

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

enter image description here

+0

是的,太棒了!将'is.corr = FALSE'添加到_corrplot_的参数列表中解决了我的问题。非常感谢! –