Question

I have a dataset of roughly 200 variables. 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.

I'll use the iris dataset for the reproducible example. Say, here, I only want to see sepal.length on the x axis, and all other variables vs sepal.length on the y axis.

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

Creates this:

enter image description here

But instead I want just this:

enter image description here

Was it helpful?

Solution

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

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top