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

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

.. _sphx_glr_gallery_statistics_errorbar.py:


=================
Errorbar function
=================

This exhibits the most basic use of the error bar method.
In this case, constant values are provided for the error
in both the x- and y-directions.

.. GENERATED FROM PYTHON SOURCE LINES 10-22

.. code-block:: Python


    import matplotlib.pyplot as plt
    import numpy as np

    # example data
    x = np.arange(0.1, 4, 0.5)
    y = np.exp(-x)

    fig, ax = plt.subplots()
    ax.errorbar(x, y, xerr=0.2, yerr=0.4)
    plt.show()




.. image-sg:: /gallery/statistics/images/sphx_glr_errorbar_001.png
   :alt: errorbar
   :srcset: /gallery/statistics/images/sphx_glr_errorbar_001.png, /gallery/statistics/images/sphx_glr_errorbar_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 23-31

.. tags:: plot-type: errorbar, domain: statistics,

.. admonition:: References

   The use of the following functions, methods, classes and modules is shown
   in this example:

   - `matplotlib.axes.Axes.errorbar` / `matplotlib.pyplot.errorbar`


.. _sphx_glr_download_gallery_statistics_errorbar.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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