This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to add significance level to correlation heatmap using ggplot2

I have generated some correlation heatmaps. I want to know how can I replace r-values in each cell of the plot with the p-value? These value inside the heatmap are correlation coefficients, I want to replace them with the p-values, or have both p-value and r-value in each cell! This is my R-table

head(data)
            env Chr01 Chr05 Chr11 Chr13_a Chr13_b
1   env1    0.4816731  -0.44170625    0.4635633     0.50192843    -0.56908075
2  env10    0.1311885   0.09209417    0.0499076    -0.01852129    -0.07120534
3  env11    0.2081285   0.01291618    0.1278969     0.06452087    -0.13677310

enter link description here

I am using this code

heatmap.2(data,col=greenred(10),scale="row", trace="none",cellnote = data)
ggplot correlation r

1 answer

To show two dimensions of data, you could use a so-called "bubble plot", in which the gradient of bubble radii represents r-values and the gradient of bubble color represents p-values (or vice versa).

See the following for a demonstration: http://t-redactyl.io/blog/2016/02/creating-plots-in-r-using-ggplot2-part-6-weighted-scatterplots.html

Log in to answer this question.