anakar
anakar

Reputation: 356

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: enter image description here

Upvotes: 2

Views: 3861

Answers (1)

Darío Rocha
Darío Rocha

Reputation: 140

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)

Upvotes: 4

Related Questions