import hvplot.pandas # noqa
heatmap
can be data has two categorical axes. Data can either be pre-computed into a matrix, or it can be 1d and the aggregation will be computed when rendering.
from bokeh.sampledata import sea_surface_temperature as sst
df = sst.sea_surface_temperature
df.tail()
In the first example, we'll make a sea surface temperature calendar of sorts:
df.hvplot.heatmap(x='time.month', y='time.day', C='temperature',
height=500, width=500, colorbar=False)
If the value for each section of the heatmap is pre-computed, then use x='index'
and y='columns'
to plot those values. Note to see how to make this same plot in bokeh, see the bokeh docs.
from bokeh.sampledata.unemployment1948 import data
data = data.set_index('Year').drop('Annual', axis=1).transpose()
data.head()
data.hvplot.heatmap(
x='columns',
y='index',
title='US Unemployment 1948—2016',
cmap=["#75968f", "#a5bab7", "#c9d9d3", "#e2e2e2", "#dfccce", "#ddb7b1", "#cc7878", "#933b41", "#550b1d"],
xaxis='top',
rot=70,
width=800, height=300).opts(
toolbar=None,
fontsize={'title': 10, 'xticks': 5, 'yticks': 5}
)