下面的脚本生成一个图,其中重要性的pch符号与r值重叠。如何移动pch符号的位置以使它们不与这些值重叠?
library(corrplot)
ex.mat <- matrix(c(1.00,0.46,-0.75,1.00,0.46,1.00,0.00,0.46,-0.75,0.00,1.00,-0.75,1.00,0.46,-0.75,1.00), nrow = 4, ncol = 4)
ex.pmat <- matrix(c(NA,0.2939,0.0522,0.0000,0.2939,NA,1.0000,0.2939,0.0522,1.0000,NA,0.0522,0.0000,0.2939,0.0522,NA), nrow = 4, ncol = 4)
corrplot(ex.mat, p.mat = ex.pmat ,sig.level = c(.001, .01, .05), type = "upper",
insig = "label_sig", pch.cex = 1.5,
tl.col = "black", method = "color", tl.srt = 28, number.cex = 1, tl.cex = 1, addCoef.col = "dodgerblue",
pch.col = "tomato", font.main = 4, family = "serif", mar=c(0,0,1,0), cl.pos = "b")
能够实现自动化是理想的,但可以手动完成:
ex.mat <- matrix(c(1.00,0.46,-0.75,1.00,0.46,1.00,0.00,0.46,-0.75,0.00,1.00,-0.75,1.00,0.46,-0.75,1.00), nrow = 4, ncol = 4)
ex.pmat <- matrix(c(NA,0.2939,0.0522,0.0000,0.2939,NA,1.0000,0.2939,0.0522,1.0000,NA,0.0522,0.0000,0.2939,0.0522,NA), nrow = 4, ncol = 4)
corrplot(ex.mat, type = "upper",
insig = "label_sig", pch.cex = 1.5, cl.length = 3,
tl.col = "black", method = "color", tl.srt = 28, number.cex = 1, tl.cex = 1, addCoef.col = "dodgerblue",
pch.col = "tomato", font.main = 4, family = "serif", mar=c(0,0,1,0), cl.pos = "b")
points(4.35, 4.25 , type = "p", pch = "*", cex = 2, col = "ivory")
points(4.20, 4.25 , type = "p", pch = "*", cex = 2, col = "ivory")
points(4.05, 4.25 , type = "p", pch = "*", cex = 2, col = "ivory")