

.. _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.




.. image:: /gallery/statistics/images/sphx_glr_errorbar_001.png
    :align: center





.. code-block:: python


    import numpy as np
    import matplotlib.pyplot as plt

    # 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()

**Total running time of the script:** ( 0 minutes  0.026 seconds)



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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

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

    `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
