Kde#

Download this notebook from GitHub (right-click to download).


import hvplot.pandas  # noqa

Kernel density estimate (kde) provides a mechanism for showing the distribution and spread of the data. In hvplot the method is exposed both as kde and density.

from bokeh.sampledata import sea_surface_temperature as sst

df = sst.sea_surface_temperature
df.tail()
temperature
time
2017-03-21 22:00:00+00:00 4.000
2017-03-21 22:30:00+00:00 3.975
2017-03-21 23:00:00+00:00 4.017
2017-03-21 23:30:00+00:00 4.121
2017-03-22 00:00:00+00:00 4.316
df.hvplot.kde()

There are many options exposed and explorable using tab completion. In this case we’ll create a colormap that spans the rainbow and divide the temperature by month.

import numpy as np
import colorcet as cc
categorical_cmap = [cc.rainbow[int(i)] for i in np.linspace(0, 255, 12)]
df.hvplot.kde(by='time.month', cmap=categorical_cmap, legend='top', height=400)
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Download this notebook from GitHub (right-click to download).