Simple Heatmap#
A simple heatmap showing the relationship between two categorical variables and a numeric value. This example uses a small pivoted dataset to highlight value intensity across a grid.
import pandas as pd
import numpy as np
import hvplot.pandas # noqa
np.random.seed(42)
df = pd.DataFrame({
'x': np.tile(['A', 'B', 'C', 'D'], 4),
'y': np.repeat(['W', 'X', 'Y', 'Z'], 4),
'value': np.random.randint(1, 10, size=16)
})
df.hvplot.heatmap(x='x', y='y', C='value', title='Basic Heatmap (Bokeh)')
import pandas as pd
import numpy as np
import hvplot.pandas # noqa
hvplot.extension('matplotlib')
np.random.seed(42)
df = pd.DataFrame({
'x': np.tile(['A', 'B', 'C', 'D'], 4),
'y': np.repeat(['W', 'X', 'Y', 'Z'], 4),
'value': np.random.randint(1, 10, size=16)
})
df.hvplot.heatmap(x='x', y='y', C='value', title='Basic Heatmap (Matplotlib)')
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.