简体   繁体   中英

Font size of p-values in a significance corrplot

Can anyone advise please:

I am using corrplot to obtain p-values for variables. number.cex= does not alter the font size of the p-values. Presently, I have a corrplot with outsize (unreadable) p-values, given that I have a relatively large number of variables (n = 27).

I've not been able to find any information on this via Rseek or Stack Overflow...

The below code was taken from here .

There is some overly complicated-looking code here that I could not get on with. Below is the code I'm using:

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

Altering the value of number.cex results in no change to the font size of p-values.

Many thanks :-)

This plots the correlations of variables in mtcars , but this should work for you. You can adjust the mag.factor and par(cex = 0.7) to suit your needs:

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

It was modified from an answer to a similar problem here: How to change font size of the correlation coefficient in corrplot?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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