简体   繁体   中英

Corrplot with only one variable on x axis

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:

在此处输入图片说明

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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