简体   繁体   English

Corrplot output 格式

[英]Corrplot output format

I am currently trying to fix the visual output of a generated Corrplot but have so far been unsuccessful with two things:我目前正在尝试修复生成的 Corrplot 的视觉 output 但到目前为止有两件事没有成功:

  1. The title always gets chopped off the top标题总是从顶部被砍掉

  2. I can't change the color of the labels from red to black我无法将标签的颜色从红色更改为黑色

    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")

Additionally, is it possible to just keep the first 2 variables (ie A and B) and show the correlation horizontal with every other parameter CE?此外,是否可以只保留前 2 个变量(即 A 和 B)并显示与所有其他参数 CE 的水平相关性? Thanks for the pointers!谢谢指点!

To keep the title from being truncated, use the mar parameter.要防止标题被截断,请使用mar参数。
To adjust the color of the labels, use the tl.col parameter.要调整标签的颜色,请使用tl.col参数。
To have a horizontal display that only shows (A,B) by (C,D,E), get rid of type="upper" and diag=F ,要使水平显示仅按 (C,D,E) 显示 (A,B),请去掉type="upper"diag=F
add is.corr=F and then just use the part of the matrix that you want X[1:2,3:5] .添加is.corr=F然后只使用您想要的矩阵部分X[1:2,3:5]

Putting that all together, we get把所有这些放在一起,我们得到

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")

调整后的校正图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM