重要性Corplot中p值的字体大小

时间:2019-06-06 08:48:17

标签: r r-corrplot

任何人都可以建议:

我正在使用corrplot获取变量的p值。 number.cex =不会更改p值的字体大小。 目前,假设我有相对大量的变量(n = 27),则我的corrplot具有超大(不可读)的p值。

我无法通过Rseek或Stack Overflow找到关于此的任何信息...

以下代码摘自here

有一些看起来过于复杂的代码here我无法理解。下面是我正在使用的代码:

corrplot(HG_lipid_matrix, p.mat = res1$p, insig = "p-value", 
         sig.level = .05, number.cex = 0.2)

更改number.cex的值不会更改p值的字体大小。

非常感谢:-)

1 个答案:

答案 0 :(得分:0)

这将绘制mtcars中变量的相关性,但这对您来说应该有用。 您可以根据自己的需要调整mag.factorpar(cex = 0.7)

library(corrplot) #read-in corrplot package
M <- cor(mtcars) #obtain matrix of correlation coefficients (r values)
mag.factor <- 2 #fudge factor to increase size of axis (tl.cex) and legend (cl.tex) text relative to p-value text
res1 <- cor.mtest(mtcars, conf.level = .95) #obtain matrix of correlation p-values
cex.before <- par("cex") #saves current cex setting for plotting
par(cex = 0.7)  #set cex for plotting text.  this invisibly affects p-value text.
corrplot(M, p.mat = res1$p, insig = "p-value", sig.level = -1, tl.cex = par("cex") * mag.factor, cl.cex = par("cex") * mag.factor) #makes the plot
par(cex = cex.before) #reset cex to initial setting

它是从这里对类似问题的回答中修改的:How to change font size of the correlation coefficient in corrplot?