{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Errorbar limit selection\n\nIllustration of selectively drawing lower and/or upper limit symbols on\nerrorbars using the parameters ``uplims``, ``lolims`` of `~.pyplot.errorbar`.\n\nAlternatively, you can use 2xN values to draw errorbars in only one direction.\n\n.. redirect-from:: /gallery/lines_bars_and_markers/errorbar_limits_simple\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nfig = plt.figure()\nx = np.arange(10)\ny = 2.5 * np.sin(x / 20 * np.pi)\nyerr = np.linspace(0.05, 0.2, 10)\n\nplt.errorbar(x, y + 3, yerr=yerr, label='both limits (default)')\n\nplt.errorbar(x, y + 2, yerr=yerr, uplims=True, label='uplims=True')\n\nplt.errorbar(x, y + 1, yerr=yerr, uplims=True, lolims=True,\n             label='uplims=True, lolims=True')\n\nupperlimits = [True, False] * 5\nlowerlimits = [False, True] * 5\nplt.errorbar(x, y, yerr=yerr, uplims=upperlimits, lolims=lowerlimits,\n             label='subsets of uplims and lolims')\n\nplt.legend(loc='lower right')"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Similarly ``xuplims`` and ``xlolims`` can be used on the horizontal ``xerr``\nerrorbars.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "fig = plt.figure()\nx = np.arange(10) / 10\ny = (x + 0.1)**2\n\nplt.errorbar(x, y, xerr=0.1, xlolims=True, label='xlolims=True')\ny = (x + 0.1)**3\n\nplt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits,\n             label='subsets of xuplims and xlolims')\n\ny = (x + 0.1)**4\nplt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True, label='xuplims=True')\n\nplt.legend()\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. admonition:: References\n\n   The use of the following functions, methods, classes and modules is shown\n   in this example:\n\n   - `matplotlib.axes.Axes.errorbar` / `matplotlib.pyplot.errorbar`\n\n.. tags::\n\n   component: error\n   plot-type: errorbar\n   level: beginner\n\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}