
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "plot_types/stats/errorbar_plot.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_stats_errorbar_plot.py>`
        to download the full example code.

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

.. _sphx_glr_plot_types_stats_errorbar_plot.py:


==========================
errorbar(x, y, yerr, xerr)
==========================
Plot y versus x as lines and/or markers with attached errorbars.

See `~matplotlib.axes.Axes.errorbar`.

.. GENERATED FROM PYTHON SOURCE LINES 9-29



.. image-sg:: /plot_types/stats/images/sphx_glr_errorbar_plot_001.png
   :alt: errorbar plot
   :srcset: /plot_types/stats/images/sphx_glr_errorbar_plot_001.png, /plot_types/stats/images/sphx_glr_errorbar_plot_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:
    np.random.seed(1)
    x = [2, 4, 6]
    y = [3.6, 5, 4.2]
    yerr = [0.9, 1.2, 0.5]

    # plot:
    fig, ax = plt.subplots()

    ax.errorbar(x, y, yerr, fmt='o', linewidth=2, capsize=6)

    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_stats_errorbar_plot.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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