[英]Use network_plot to visualise correlation matrix in R
我想可视化 60 多个属性的相关矩阵。 我试过'library(corrplot)',结果显示警告:“重叠太多”。 然后我试了一下,显示一个乱七八糟的plot标签太大,曲线重叠。
library(corrr)
data %>% correlate() %>% network_plot(min_cor = 0.4)
我尝试在https://www.rdocumentation.org/packages/memnet/versions/0.1.0/topics/network_plot之后调整 label 大小和曲线宽度,它显示错误:
network_plot 中的错误(相关(数据),min_cor = 0.4,nod_cex = 2,:未使用的 arguments(nod_cex = 2,lab_cex = 1,lab_lwd = 2)
memnet
is a deprecated package that has been removed from CRAN so this is normal you can't use the network_plot
from this package, but here you are using the network_plot
function from the corrr
package which haven't the same arguments: https:// www.rdocumentation.org/packages/corrr/versions/0.4.3/topics/network_plot
有 60 个变量,我不认为network_plot
是可视化的最佳选择。 但是,您可以尝试按如下方式使用corrplot
:
#Create a data frame with random values
df=data.frame(replicate(60,sample(0:60,10,rep=TRUE)))
cor=cor(df)
cor2 <- corrplot::corrMatOrder(cor, order = "FPC", hclust.method = "average")
corrplot::corrplot(cor[cor2,cor2], diag = F, type = "lower",
method = "color", mar = c(1,1,3,1), tl.srt = 60, tl.cex = 0.4)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.