校正图输出格式

Corrplot output format

我目前正在尝试修复生成的 Corrplot 的视觉输出,但到目前为止有两件事没有成功:

  1. 标题总是被砍掉

  2. 我无法将标签的颜色从红色更改为黑色

    A <- seq(1, 100, by=1)
    B <- sample(A,100, replace =T)
    C <- sample(A,100, replace =T)
    D <- sample(A,100, replace =T)
    E <- sample(A,100, replace =T)
    sample(A,100, replace =T)
    X <- data.frame(A,B,C,D,E)
    
    X <- cor(X, method = c("spearman"))
    
    corrplot(X,
     method = "circle",
     type = "upper",
     diag = F,
     addCoef.col=T,
     title = "Testing")
    

此外,是否可以仅保留前 2 个变量(即 A 和 B)并显示与其他所有参数的水平相关性 C-E?谢谢指点!

要防止标题被截断,请使用 mar 参数。
要调整标签的颜色,请使用 tl.col 参数。
要有一个仅显示 (A,B) 乘以 (C,D,E) 的水平显示, 摆脱 type="upper"diag=F,
添加 is.corr=F 然后只使用您想要的矩阵部分 X[1:2,3:5].

将所有这些放在一起,我们得到

corrplot(X[1:2,3:5],
 is.corr=FALSE,
 method = "circle",
 addCoef.col=T,
 mar=c(0,0,5,0),
 tl.col = "black",
 title = "Testing")