如何解决R相关性分析:尝试使用ggcorrplot2来重现带有变量子集和不同子集的ggcorrplot
我试图用变量的子集与不同的子集进行相关图。
使用mtcars
数据,我使用ggcorrplot
执行以下操作:
data(mtcars)
corrtest <- psych::corr.test(mtcars[,1:7],adjust="none")
all_matrix <- corrtest$r
all_pmat <- corrtest$p
pheno_markers <- names(mtcars)[1:4]
serol_markers <- names(mtcars)[5:7]
sub_matrix <- all_matrix[pheno_markers,serol_markers]
sub_pmat <- all_pmat[pheno_markers,serol_markers]
Grdevices::pdf(file="heat_duo.pdf",height=4,width=4)
print(
ggcorrplot::ggcorrplot(sub_matrix,p.mat=sub_pmat,method="circle")
)
Grdevices::dev.off()
这将产生以下图表,这是很好的:
现在,我想用ggcorrplot2
重现相同的图,因为它允许我将比较的有效值覆盖为***
。我通常可以毫无问题地使用此程序包,但这种情况我似乎并没有得到解决。看来只能用colnames
== rownames
...
我尝试了以下操作:
Grdevices::pdf(file="heat_duo2.pdf",width=4)
print(
ggcorrplot2::ggcorrplot(sub_matrix,method="circle",insig = "label_sig",sig.lvl = c(0.05,0.01,0.001))
)
Grdevices::dev.off()
但是结果显然是错误的:
在ggcorrplot2
中如何处理这样的案件有任何想法(ggcorrplot
如此简单)?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。