简体   繁体   English

在x轴上只有一个变量的Corrplot

[英]Corrplot with only one variable on x axis

I have a dataset of roughly 200 variables. 我有大约200个变量的数据集。 I'm looking to understand how one of those variables correlates with all the others. 我想了解这些变量之一与所有其他变量之间的关系。 However, when I use corrplot() , it gives me the full correlation matrix that's 200x200 cells in size - and way to big to be visualized well. 但是,当我使用corrplot() ,它为我提供了完整的相关矩阵,该矩阵的大小为200x200 ,并且可以很好地可视化。

I'll use the iris dataset for the reproducible example. 对于可重现的示例,我将使用iris数据集。 Say, here, I only want to see sepal.length on the x axis, and all other variables vs sepal.length on the y axis. 说,在这里,我只想在x轴上看到sepal.length ,在y轴上看到所有其他变量vs sepal.length

library(corrplot) 
corrplot(cor(iris[,1:4]))

Creates this: 创建此:

在此处输入图片说明

But instead I want just this: 但是我只想要这样:

在此处输入图片说明

You can just take the first column of your matrix and suppress the color labels: 您可以仅选择矩阵的第一列并取消显示颜色标签:

corrplot(cor(iris[,1:4])[1:4,1, drop=FALSE], cl.pos='n')

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM