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

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_lines_bars_and_markers_errorbar_limits_simple.py>`
        to download the full example code

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

.. _sphx_glr_gallery_lines_bars_and_markers_errorbar_limits_simple.py:


========================
Errorbar limit selection
========================

Illustration of selectively drawing lower and/or upper limit symbols on
errorbars using the parameters ``uplims``, ``lolims`` of `~.pyplot.errorbar`.

Alternatively, you can use 2xN values to draw errorbars in only one direction.

.. GENERATED FROM PYTHON SOURCE LINES 11-36

.. code-block:: default


    import numpy as np
    import matplotlib.pyplot as plt


    fig = plt.figure()
    x = np.arange(10)
    y = 2.5 * np.sin(x / 20 * np.pi)
    yerr = np.linspace(0.05, 0.2, 10)

    plt.errorbar(x, y + 3, yerr=yerr, label='both limits (default)')

    plt.errorbar(x, y + 2, yerr=yerr, uplims=True, label='uplims=True')

    plt.errorbar(x, y + 1, yerr=yerr, uplims=True, lolims=True,
                 label='uplims=True, lolims=True')

    upperlimits = [True, False] * 5
    lowerlimits = [False, True] * 5
    plt.errorbar(x, y, yerr=yerr, uplims=upperlimits, lolims=lowerlimits,
                 label='subsets of uplims and lolims')

    plt.legend(loc='lower right')





.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_errorbar_limits_simple_001.png
    :alt: errorbar limits simple
    :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    <matplotlib.legend.Legend object at 0x7f73b7d7f6d0>



.. GENERATED FROM PYTHON SOURCE LINES 37-39

Similarly ``xuplims`` and ``xlolims`` can be used on the horizontal ``xerr``
errorbars.

.. GENERATED FROM PYTHON SOURCE LINES 39-56

.. code-block:: default


    fig = plt.figure()
    x = np.arange(10) / 10
    y = (x + 0.1)**2

    plt.errorbar(x, y, xerr=0.1, xlolims=True, label='xlolims=True')
    y = (x + 0.1)**3

    plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits,
                 label='subsets of xuplims and xlolims')

    y = (x + 0.1)**4
    plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True, label='xuplims=True')

    plt.legend()
    plt.show()




.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_errorbar_limits_simple_002.png
    :alt: errorbar limits simple
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 57-64

------------

References
""""""""""

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

.. GENERATED FROM PYTHON SOURCE LINES 65-69

.. code-block:: default


    import matplotlib
    matplotlib.axes.Axes.errorbar
    matplotlib.pyplot.errorbar




.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    <function errorbar at 0x7f73be827280>




.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_gallery_lines_bars_and_markers_errorbar_limits_simple.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_limits_simple.py <errorbar_limits_simple.py>`



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

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
