【发布时间】:2019-06-23 12:38:50
【问题描述】:
试图将系数值(下角)和显着性(上角)放在一起
尝试使用 corrplot.mixed 但做错了
library(corrplot)
library(Hmisc)
mydata <- read.csv("HiBAPPaperv2_Corre.csv")
mydata.cor = cor(mydata, method = "pearson")
mydatrou= round(mydata.cor, 2)
H1517 <- cor(mydatrou)
#corrplot(H1517, method = "circle")
H1517_2 <- rcorr(as.matrix(mydata))
# Extract the correlation coefficients
H1517_2$r
# Extract p-values
H1517_2$P
## add all p-values
col1 <- colorRampPalette(c("#7F0000", "red", "#FF7F00", "yellow", "white",
"#00ff11", "#007FFF", "blue", "#00007F"))
col2 <- colorRampPalette(c("#67001F", "#B2182B", "#D6604D", "#F4A582",
"#FDDBC7", "#FFFFFF", "#D1E5F0", "#92C5DE",
"#4393C3", "#2166AC", "#053061"))
col3 <- colorRampPalette(c("red", "white", "blue"))
col4 <- colorRampPalette(c("#7F0000", "red", "#FF7F00", "yellow", "#7FFF7F",
"#00ff11", "#007FFF", "blue", "#00007F"))
whiteblack <- c("white", "black")
## using these color spectra
corrplot.mixed(H1517, upper = "square", p.mat = H1517_2$P, insig = "label_sig", addrect = 3,col = col4(10), sig.level = c(.001, .01, .05), pch.cex = 1,
lower = "number", tl.pos = "lt", tl.col = "black", tl.offset=1, tl.srt = 0)
由于以下原因无法绘图:corrplot 中的错误(corr,type = "upper",method = upper,diag = TRUE,tl.pos = tl.pos,: 由多个实际参数匹配的形式参数“col”
【问题讨论】:
-
一个minimal reproducible example 会很好...
标签: r matrix correlation r-corrplot hmisc