.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/06_sequences/plot_01_index_plot.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_06_sequences_plot_01_index_plot.py: Sequence index plots with pattern occurrences ============================================= The index plot of social-science sequence analysis (Brzinsky-Fay, 2014) draws every sequence as a row of colored cells. Combined with the mined patterns it answers *where* a frequent sequence occurs: the earliest occurrence of each highlighted pattern is marked, and sorting by the patterns brings the supporting sequences to the top. .. GENERATED FROM PYTHON SOURCE LINES 11-20 .. code-block:: Python import matplotlib.pyplot as plt import spmviz as sv from spmviz.viz import plot_sequence_index db = sv.datasets.make_alarm_cascades(400, random_state=0) plot_sequence_index(db, max_sequences=80, sort="pattern", highlight=["P-LOWFLOW P-TRIP OP-PUMPSTART", "C-HITEMP C-VALVE"], max_length=14) .. image-sg:: /auto_examples/06_sequences/images/sphx_glr_plot_01_index_plot_001.png :alt: sequence index plot — marked: P-LOWFLOW → P-TRIP → OP-PUMPSTART; C-HITEMP → C-VALVE :srcset: /auto_examples/06_sequences/images/sphx_glr_plot_01_index_plot_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 21-23 Sorted by length ---------------- .. GENERATED FROM PYTHON SOURCE LINES 23-25 .. code-block:: Python plot_sequence_index(db, max_sequences=80, sort="length", max_length=14) plt.show() .. image-sg:: /auto_examples/06_sequences/images/sphx_glr_plot_01_index_plot_002.png :alt: sequence index plot :srcset: /auto_examples/06_sequences/images/sphx_glr_plot_01_index_plot_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.788 seconds) .. _sphx_glr_download_auto_examples_06_sequences_plot_01_index_plot.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/ComplexSystemsIntelligence/spmviz/main?urlpath=lab/tree/notebooks/auto_examples/06_sequences/plot_01_index_plot.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_index_plot.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_index_plot.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_index_plot.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_