Title
HeatMap Element
Dependencies
Plotly
Backends
Bokeh
Matplotlib
Plotly

In [ ]:
import numpy as np
import holoviews as hv
hv.extension('plotly')

HeatMap visualises tabular data indexed by two key dimensions as a grid of colored values. This allows spotting correlations in multivariate data and provides a high-level overview of how the two variables are plotted.

The data for a HeatMap may be supplied as 2D tabular data with one or more associated value dimensions. The first value dimension will be colormapped, but further value dimensions may be revealed using the hover tool.


In [ ]:
data = [(chr(65+i), chr(97+j),  i*j) for i in range(5) for j in range(5) if i!=j]
hv.HeatMap(data).opts(cmap='RdBu_r')

It is important to note that the data should be aggregated before plotting as the HeatMap cannot display multiple values for one coordinate and will simply use the first value it finds for each combination of x- and y-coordinates.


In [ ]:
heatmap = hv.HeatMap([(0, 0, 0), (0, 0, 10), (1, 0, 2), (1, 1, 3)])
aggregate = heatmap.aggregate(function=np.max)
heatmap + aggregate.opts(colorbar=True)

As the above example shows before aggregating the second value for the (0, 0) is ignored unless we aggregate the data first.

For full documentation and the available style and plot options, use hv.help(hv.HeatMap).