"""
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)
# %%
# 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()
