Corrplot在x轴上只有一个变量

时间:2014-05-12 15:33:32

标签: r heatmap correlation r-corrplot

我有一个大约200个变量的数据集。我想了解其中一个变量如何与其他变量相关联。但是,当我使用corrplot()时,它会给我一个完整的相关矩阵,其大小为200x200个单元格 - 并且可以很好地实现可视化。

我将使用iris数据集作为可重现的示例。说,在这里,我只想在x轴上看到sepal.length,在y轴上看到所有其他变量与sepal.length

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

创建此:

enter image description here

但我只想要这个:

enter image description here

1 个答案:

答案 0 :(得分:5)

您可以只取矩阵的第一列并抑制颜色标签:

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

enter image description here