Heatmap





A heatmap is a graphical representation of data where the individual values contained in a matrix are represented as colors. This page displays many examples built with R, both static and interactive.

Using the heatmap() function

The heatmap() function is natively provided in R. It produces high quality matrix and offers statistical tools to normalize input data, run clustering algorithm and visualize the result with dendrograms. It is one of the very rare case where I prefer base R to ggplot2.





Using geom_tile() from ggplot2

ggplot2 also allows to build heatmaps thanks to geom_tile(). However, I personally prefer the heatmap() function above since only it offers option for normalization, clustering and Dendrogram.





Heatmap for time series

Heatmaps can be a very good alternative to visualize time series, especially when the time frame you study is repeating, like weeks. Here is a customized example, but visit the time series section for more.

Code Time series section
heatmap for time series in R




Using the levelplot() function of lattice

Related chart types


Scatter
Heatmap
Correlogram
Bubble
Connected scatter
Density 2d