.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_auto_examples/get_style.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr__auto_examples_get_style.py: Get Style Example ===================================== :func:`sysplot.get_style` returns a style dict (color, linestyle, marker) from the configured cycler. Styles can be retrieved by explicit ``index`` or by passing an ``ax`` to advance the cycler automatically. .. GENERATED FROM PYTHON SOURCE LINES 8-37 .. image-sg:: /_auto_examples/images/sphx_glr_get_style_001.png :alt: index mode, ax mode :srcset: /_auto_examples/images/sphx_glr_get_style_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import sysplot as ssp ssp.apply_config() x = np.linspace(0, 1, 50) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=ssp.get_figsize(1, 2)) # ── index mode ─────────────────────────────────────────────────────────────── # Each call picks a fixed slot from the cycler regardless of call order. for i in range(4): ax1.plot(x, x + i * 0.3, label=f"index={i}", **ssp.get_style(index=i)) ax1.set(title="index mode", xlabel="x", ylabel="y") ax1.legend() # ── ax mode ─────────────────────────────────────────────────────────────────── # each call picks the next style from the cycler for i in range(4): ax2.plot(x, x + i * 0.3, label=f"line {i}", **ssp.get_style(ax=ax2)) ax2.set(title="ax mode", xlabel="x", ylabel="y") ax2.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.492 seconds) .. _sphx_glr_download__auto_examples_get_style.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: get_style.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: get_style.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: get_style.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_