Thank you so much. That was very helpful :)
I am aiming to create a heatmap similar to the one below.
I have successfully generated one that is satisfactory EXCEPT for the color scale (below). I used the code:
heatmap(Hallmark3, Colv = NA, Rowv = NA, scale="column", cexRow=.8, cexCol=1)
The coloring must indicate time of day so I would like it to be continuous and depict 0-24hrs. This is what they have done in the first heat map. I will also need to figure out how to add a legend showing the scale where it starts at 0 and ends at 24 (marking every 6hrs as in the first image). I think maybe I might have to do something indicating the scale represents radians or something along those lines but I am lost on how to get there.
1 answer
Just use a symmetrical color palette and pass it into the col= argument.
pal <- colorRampPalette(c('blue', 'brown', 'blue'))
plot(1:50, rep(1,50), col=pal(50), pch=16)
heatmap(..., col=pal(100))
The color bar needs to be added separately with a legend call, or you can switch to a more complete heatmap package such as ComplexHeatmap, Superheat or many others that add the color bar automatically.
Log in to answer this question.