"""
Sequence logos
==============

Borrowed from bioinformatics (Schneider & Stephens, 1990): every column stacks
the events seen at a position relative to an anchor, letter heights
proportional to their probability times the information content of the column
(:math:`\\log_2 K - H`). Conserved steps are tall, variable steps are low.
"""

import matplotlib.pyplot as plt

import spmviz as sv
from spmviz.viz import plot_sequence_logo

shop = sv.datasets.make_customer_journeys(1000, random_state=0)
plot_sequence_logo(shop, anchor="cart", before=3, after=4)
# %%
# The openings of melodies
# ------------------------
songs = sv.datasets.load_melodies("phrase")
plot_sequence_logo(songs, before=0, after=6, info=False, title="first notes of the phrases (probabilities)")
plt.show()
