当绘制相关系数时,GGally :: ggpairs不绘制网格线 [英] GGally::ggpairs plot without gridlines when plotting correlation coefficient

查看:612
本文介绍了当绘制相关系数时,GGally :: ggpairs不绘制网格线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GGally :: ggpairs 绘制如下图所示的漂亮图形。我唯一需要改进的地方就是删除所有绘图上部的网格线,相关系数在哪里。

  library(GGally)
数据(虹膜)
ggpairs(iris [,1:4],lower = list(continuous =smooth,params = c(color =blue)),
diag = list(continuous =bar,params = c(color =blue)),
upper = list(params = list(corSize = 6)),axisLabels ='show')

解决方案

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

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

 主题(legend.positi on =none,
panel.grid.major = element_blank(),
axis.ticks = element_blank(),
panel.border = element_rect(linetype =dashed,color = black,fill = NA))


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.

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')

解决方案

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

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不绘制网格线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆