绘制相关系数时GGally :: ggpairs绘图没有网格线

时间:2021-11-08 01:37:07

GGally::ggpairs plots nice graphs like following one. Only thing I seek to refine it even more is to remove all gridlines in upper part of plot, where is correlation coefficient. An maybe also draw rectangle around each upper graph.

GGally :: ggpairs绘制了很好的图形,如下图所示。我唯一想要进一步完善它的是删除绘图上部的所有网格线,其中是相关系数。也许还可以在每个上图周围绘制矩形。

library("GGally")
data(iris)
ggpairs(iris[, 1:4], lower=list(continuous="smooth", params=c(colour="blue")),
  diag=list(continuous="bar", params=c(colour="blue")), 
  upper=list(params=list(corSize=6)), axisLabels='show')

绘制相关系数时GGally :: ggpairs绘图没有网格线

1 个解决方案

#1


11  

Check out this related question and my forked repo. Use assignInNamespace to modify ggally_cor function as shown in the aforementioned question.

看看这个相关的问题和我的分叉回购。使用assignInNamespace修改ggally_cor函数,如上述问题所示。

The only thing that needs to be done is modifying theme call:

唯一需要做的是修改主题调用:

  theme(legend.position = "none", 
        panel.grid.major = element_blank(), 
        axis.ticks = element_blank(), 
        panel.border = element_rect(linetype = "dashed", colour = "black", fill = NA))

绘制相关系数时GGally :: ggpairs绘图没有网格线

#1


11  

Check out this related question and my forked repo. Use assignInNamespace to modify ggally_cor function as shown in the aforementioned question.

看看这个相关的问题和我的分叉回购。使用assignInNamespace修改ggally_cor函数,如上述问题所示。

The only thing that needs to be done is modifying theme call:

唯一需要做的是修改主题调用:

  theme(legend.position = "none", 
        panel.grid.major = element_blank(), 
        axis.ticks = element_blank(), 
        panel.border = element_rect(linetype = "dashed", colour = "black", fill = NA))

绘制相关系数时GGally :: ggpairs绘图没有网格线