2017-09-24 119 views
1

我有一個數據幀的樣子更簡單的方法:繪製相關矩陣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

回答

0

對於您提供的示例數據,似乎並不需要很多轉換。

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

Corrplot