Note
Go to the end to download the full example code or to run this example in your browser via Binder.
Chord diagram of everyday transitions#
A chord diagram arranges the activities on a circle; a ribbon from one arc to another carries the transitions between them (colored by the source). It shows the loops of a day at a glance: work ↔ lunch, dinner → tv → sleep.
import matplotlib.pyplot as plt
import spmviz as sv
from spmviz.viz import plot_chord
db = sv.datasets.make_daily_routines(300, random_state=0)
plot_chord(db, top=12)

<Axes: title={'left': 'chord diagram of transitions (colored by source)'}>
One chord per persona#
fig, axes = plt.subplots(1, 3, figsize=(16, 5.5))
for ax, (who, sub) in zip(axes, db.split("persona").items()):
plot_chord(sub, ax=ax, top=10, title=who)
plt.show()

Total running time of the script: (0 minutes 0.243 seconds)