0

I am building a simple heatmap in base R. This is my matrix:

stleft = matrix( 
     c(0,5,5,2,6,8,4,6,9), 
     nrow=3, 
     ncol=3) 
colnames(stleft) <- c("Narrow","Wide", "Wider")
rownames(stleft) <- c("Person", "Object","Bare")
stleft

The matrix looks like this:

> stleft
       Narrow Wide Wider
Person      0    2     4
Object      5    6     6
Bare        5    8     9

To build the heat map I simply run:

par(oma=c(3, 0, 0, 3))
col <- rev(heat.colors(999))
heatmap(stleft, Colv = NA, Rowv = NA, scale = "none")

enter image description here

Do you know how I can insert the matrix's numbers in the heat map's cells?

Emy
  • 667
  • 5
  • 21

0 Answers0