
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "plot_types/basic/stairs.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_plot_types_basic_stairs.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_plot_types_basic_stairs.py:


==============
stairs(values)
==============
Draw a stepwise constant function as a line or a filled plot.

See `~matplotlib.axes.Axes.stairs` when plotting :math:`y` between
:math:`(x_i, x_{i+1})`. For plotting :math:`y` at :math:`x`, see
`~matplotlib.axes.Axes.step`.

.. redirect-from:: /plot_types/basic/step

.. GENERATED FROM PYTHON SOURCE LINES 13-30



.. image-sg:: /plot_types/basic/images/sphx_glr_stairs_001.png
   :alt: stairs
   :srcset: /plot_types/basic/images/sphx_glr_stairs_001.png, /plot_types/basic/images/sphx_glr_stairs_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    plt.style.use('_mpl-gallery')

    # make data
    y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0]

    # plot
    fig, ax = plt.subplots()

    ax.stairs(y, linewidth=2.5)

    ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
           ylim=(0, 8), yticks=np.arange(1, 8))

    plt.show()


.. _sphx_glr_download_plot_types_basic_stairs.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: stairs.ipynb <stairs.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: stairs.py <stairs.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: stairs.zip <stairs.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
