2016-11-11 94 views
1

我正在尝试使用GGpairs创建相关矩阵,散点图由组(reg或irreg)着色。在上角绘制的相关值未对齐,如您在图像中看到的,Cor,reg和irreg值未对齐。 enter image description hereGGpairs,相关值不对齐

我使用的代码是这样的:

ggpairs(data=dat4, 
    columns=1:5, 
    title="correlation matrix",    
    mapping= aes(colour = irregular), 
    lower = list(
    continuous = "smooth", 
    combo = "facetdensity", 
    mapping = aes(color = irregular))) 

的数据是在这里:replicatable data

什么建议吗?谢谢谢谢!

回答

2

这似乎工作:

ggpairs(data=dat4, 
     columns=1:5, 
     title="correlation matrix",    
     mapping= aes(colour = irregular), 
     lower = list(
      continuous = "smooth", 
      combo = "facetdensity", 
      mapping = aes(color = irregular)), 
     upper = list(continuous = wrap("cor", size = 3, hjust=0.8))) 

enter image description here

+1

太好了,谢谢Sandipan! –