GGpairs,相关值未对齐

时间:2016-11-11 02:45:19

标签: r ggplot2 ggally

我正在尝试使用GGpairs创建关联矩阵,散点图按组(reg或irreg)着色。绘制在上角的相关值未对齐,如图中所示,Cor,reg和irreg值未对齐。enter image description here

我使用的代码是:

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

有什么建议吗?谢谢,谢谢!

1 个答案:

答案 0 :(得分:3)

这似乎有效:

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