绘制相关矩阵R中无变换的数据帧

问题描述:

我有一个数据帧的样子更简单的方法:绘制相关矩阵R中无变换的数据帧

> head(mydata) 
    V1 V2 V3 
1 2 14 0.299 
2 2 41 0.284 
3 2 71 0.307 
4 3 43 0.316 
5 3 44 0.366 
6 3 84 0.405 

我的目标是绘制这样的:enter image description here

看来,很多方面需要改造数据帧使用“corrplot”或“ggcorrplot”。有没有更简单的方法将数据帧绘制到相关矩阵而不改变数据帧?

+2

基地绘图快捷:'图像(COR(DF))'。 ggplot将首先需要重新塑造,因为你没有你想要绘制的美感。一个选项是'GGally :: ggcorr(df)' – alistaire

对于您提供的示例数据,似乎并不需要很多转换。

library(corrplot) 
corrplot(cor(mydata), method="color", outline="White") 

Corrplot