{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Errorbar subsampling\n\nThe parameter *errorevery* of `.Axes.errorbar` can be used to draw error bars\nonly on a subset of data points. This is particularly useful if there are many\ndata points with similar errors.\n\n.. redirect-from:: /gallery/lines_bars_and_markers/errorbar_subsample\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\n# example data\nx = np.arange(0.1, 4, 0.1)\ny1 = np.exp(-1.0 * x)\ny2 = np.exp(-0.5 * x)\n\n# example variable error bar values\ny1err = 0.1 + 0.1 * np.sqrt(x)\ny2err = 0.1 + 0.1 * np.sqrt(x/2)\n\n\nfig, (ax0, ax1, ax2) = plt.subplots(nrows=1, ncols=3, sharex=True,\n                                    figsize=(12, 6))\n\nax0.set_title('all errorbars')\nax0.errorbar(x, y1, yerr=y1err)\nax0.errorbar(x, y2, yerr=y2err)\n\nax1.set_title('only every 6th errorbar')\nax1.errorbar(x, y1, yerr=y1err, errorevery=6)\nax1.errorbar(x, y2, yerr=y2err, errorevery=6)\n\nax2.set_title('second series shifted by 3')\nax2.errorbar(x, y1, yerr=y1err, errorevery=(0, 6))\nax2.errorbar(x, y2, yerr=y2err, errorevery=(3, 6))\n\nfig.suptitle('Errorbar subsampling')\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. 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
}