2

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

anakar
  • 316
  • 2
  • 13

1 Answers1

4

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)

Darío Rocha
  • 140
  • 1
  • 5