.. only:: html
.. 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_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.
.. code-block:: default
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()
.. image:: /gallery/statistics/images/sphx_glr_errorbar_001.png
:alt: errorbar
:class: sphx-glr-single-img
------------
References
""""""""""
The use of the following functions and methods is shown in this example:
.. code-block:: default
import matplotlib
matplotlib.axes.Axes.errorbar
matplotlib.pyplot.errorbar
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
.. _sphx_glr_download_gallery_statistics_errorbar.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: errorbar.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: errorbar.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
Keywords: matplotlib code example, codex, python plot, pyplot
`Gallery generated by Sphinx-Gallery
`_