【发布时间】:2018-09-16 14:51:24
【问题描述】:
下面的脚本会生成一个绘图,其中用于显着性的 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")
【问题讨论】:
-
如果能在右上角就太好了
标签: r plot r-corrplot