I am newbie in R scripts :-)
I Built a corrplot matrix this way:
corrplot(cor(d1[,2:14], d1[,2:14]), method=c("color"), bg = "white", addgrid.col = "gray50", tl.cex=1, type="lower", tl.col = "black", col = colorRampPalette(c("red","white","blue"))(100))
I need show the values of correlation in the lower matrix.. inside the color matrix that i built. how i can do that?
Is it possible exclude the main diagonal from the lower matrix? In this diagonla always we have the perfect correlation :-)
The other doubt.. i wanna show the significant values for the correlation using stars instead of squares. like (*, , *). Is it possible?
Can you help me guys?
With a bit of hackery you can do this in a very similar R package, corrgram
. This one allows you to easily define your own panel functions, and helpfully makes theirs easy to view as templates. Here's the some code and figure produced:
set.seed(42) library(corrgram) # This panel adds significance starts, or NS for not significant panel.signif
The code isn't very clean, as it's mostly patched together functions from the package, but it should give you a good start to get the plot you want. Possibly you can take a similar approach with the corrplot
package too.
update: Here's a version with stars and cor on the same triangle:
panel.shadeNtext
Also commented out is another way of showing significance, it'll bold those below a threshold rather than using stars. Might be clearer that way, depending on what you want to show.