R:Corrplot() 热图操作?

R: Corrplot() heatmap manipulation?

我有 2 个数据集,one being 264 columns and the other 是 19 列。

在 运行 使用 cor() 的 Pearson 相关性之后,我尝试使用 corrplot() 在热图中绘制输出,但它不可读。

如何编辑我的代码来修复 this

我的代码如下:

    library("corrplot")
    D1=VGT5
    D2=BFT5
    CorTest=cor(D1, y=D2, use = "everything", method = "pearson")
    CorGraph=corrplot(CorTest, method = "circle", col = colorRampPalette(c("blue","white","red"))(200), title = "Pearson's Correlation of High-Fat Sugar at 12 weeks", tl.cex = .75, tl.col = "Black",diag = TRUE, cl.ratio = 2.25)

您的相关矩阵有 19 行和 264 列。该矩阵的图形表示相当有问题。这里有两个可能的解决方案。
(1) 绘制整个矩阵[​​=13=]

library(ggcorrplot)
png(file="CorrPlot1.png", height=10000, width=3000, res=600)
ggcorrplot(CorTest, lab_size=.1)+
theme(axis.text.y = element_text(size=6),
      axis.text.x = element_text(size=6, angle=90))
dev.off()

(2) 将矩阵一分为二

library(gridExtra)
nc <- ncol(CorTest)
png(file="CorrPlot2.png", height=7000, width=7000, res=600)
p1 <- ggcorrplot(CorTest[,1:(nc/2)], lab_size=.1)+
theme(axis.text.y = element_text(size=6),
      axis.text.x = element_text(size=6, angle=90))
p2 <- ggcorrplot(CorTest[,(nc/2+1):nc], lab_size=.1)+
theme(axis.text.y = element_text(size=6),
      axis.text.x = element_text(size=6, angle=90))
grid.arrange(p1, p2, ncol=2)
dev.off()