简体   繁体   中英

r Heatmap values in cells - package ComplexHeatmap

I have a small matrix with numbers that I want to trnsfer into a heatmap and keep the numbers inside. This is the data:

print(cor.matrix)
          stock.GLS stock.NVS stock.PLX
stock.GLS 1.0000000 0.4078177 0.2416839
stock.NVS 0.4078177 1.0000000 0.1485917
stock.PLX 0.2416839 0.1485917 1.0000000

And this is how I make the heatmap.

I want the numbers to go inside the squares like here [ display a matrix, including the values, as a heatmap , but using this package. Any idea?

library(ComplexHeatmap)

Heatmap(cor.matrix, 
        cluster_columns=FALSE,
        cluster_rows=FALSE
       )

The output looks like this: 在此处输入图像描述

It's 2.9.1 cell_fun from the ComplexHeatmap complete reference what you are looking for ( https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#customize-the-heatmap-body )

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