Adding colour to P Values on lower triangle of corrplot

297 Views Asked by At

I have added an example of the code I am using and the output I am getting. In reality I am using a big dataset.

I am using the library corrplot to produce the plot.

I would like that for the P-Values given in the lower triangle that the numbers are a certain colour according to their value. For example P-Values in the range <0.001 to be "red" 0.01 - 0.001 "orange" 0.05 - 0.01 "yellow" and values over 0.05 to have no colour.Pearson r values are on the upper and P-values on the lower

library(Hmisc)
library(corrplot)

cor_5 <- rcorr(as.matrix(Orange))

cor_5$r[lower.tri(cor_5$r)] = cor_5$P[lower.tri(cor_5$P)]

cor_5$P[lower.tri(cor_5$P)] = 0


M <- cor_5$r
p_mat <- cor_5$P


corrplot.mixed(M, upper = 'color', lower = 'number', p.mat = p_mat,  sig.level = 1.6, insig = 'blank',
               tl.pos = 'd', lower.col = "black",  tl.col = "black")
0

There are 0 best solutions below