Corrplot具有很多变量

时间:2018-12-04 10:24:18

标签: r

我该如何纠正带有许多变量的corrplot。因为在视觉上它没有吸引力。 下面是我的代码:

corrplot(cor(dataT[,c("D_Wavg_EASI_DENSITY_CWR_2", "D_Wavg_EASI_POP16_CWR_2", 
                                "D_Wavg_EASI_URBANPOP_P_CWR_2", "D_Wavg_EASI_RURALPOP_P_CWR_2",
                                "D_Wavg_EASI_MEDHHINC_CWR_2", "D_Wavg_EASI_ED_C_P_CWR_2",
                                "D_Wavg_EASI_WHCOLROCC_P_CWR_2", "D_Wavg_EASI_BLCOLROCC_P_CWR_2",
                                "D_Wavg_EASI_CARTHEFT_CWR_2", "D_Wavg_EASI_TOTCRIME_CWR_2",
                                "D_Wavg_EASI_MAXTEMP_CWR_2", "D_Wavg_EASI_MINTEMP_CWR_2",
                                "D_Wavg_EASI_RAINDAYS_CWR_2", "D_Wavg_EASI_SNOWDAYS_CWR_2",
                                "D_Wavg_EASI_ANNULRAIN_CWR_2", "D_Wavg_EASI_ANNULSNOW_CWR_2",
                                "D_Wavg_EASI_EASIWETHI_CWR_2", "D_Wavg_EASI_MED_INC_CWR_2",
                                "D_Wavg_EASI_PROPCRIME_CWR_2","D_Wavg_EASI_LARCENY_CWR_2",
                                "D_Wavg_EASI_BURGLARY_CWR_2","D_Wavg_EASI_ROBBERY_CWR_2")]))

这就是输出的样子。变量的名称相互重叠 enter image description here

1 个答案:

答案 0 :(得分:1)

除了已经提出的建议之外,还有另一个非常简单的解决方案。 假设您有这样的数据:

cars <- cor(mtcars)

您可以通过添加参数tl.cex并定义值<1来缩小文本标签的大小,如下所示:

corrplot(cars, tl.cex=0.5)

enter image description here