.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_lines_bars_and_markers_step_demo.py: ========= Step Demo ========= Example step plots. .. image:: /gallery/lines_bars_and_markers/images/sphx_glr_step_demo_001.png :class: sphx-glr-single-img .. code-block:: python import numpy as np from numpy import ma import matplotlib.pyplot as plt x = np.arange(1, 7, 0.4) y0 = np.sin(x) y = y0.copy() + 2.5 plt.step(x, y, label='pre (default)') y -= 0.5 plt.step(x, y, where='mid', label='mid') y -= 0.5 plt.step(x, y, where='post', label='post') y = ma.masked_where((y0 > -0.15) & (y0 < 0.15), y - 0.5) plt.step(x, y, label='masked (pre)') plt.legend() plt.xlim(0, 7) plt.ylim(-0.5, 4) plt.show() .. _sphx_glr_download_gallery_lines_bars_and_markers_step_demo.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: step_demo.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: step_demo.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot `Gallery generated by Sphinx-Gallery `_