{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# 3D errorbars\n\nAn example of using errorbars with upper and lower limits in mplot3d.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\nax = plt.figure().add_subplot(projection='3d')\n\n# setting up a parametric curve\nt = np.arange(0, 2*np.pi+.1, 0.01)\nx, y, z = np.sin(t), np.cos(3*t), np.sin(5*t)\n\nestep = 15\ni = np.arange(t.size)\nzuplims = (i % estep == 0) & (i // estep % 3 == 0)\nzlolims = (i % estep == 0) & (i // estep % 3 == 2)\n\nax.errorbar(x, y, z, 0.2, zuplims=zuplims, zlolims=zlolims, errorevery=estep)\n\nax.set_xlabel(\"X label\")\nax.set_ylabel(\"Y label\")\nax.set_zlabel(\"Z label\")\n\nplt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ".. tags::\n plot-type: 3D,\n component: error,\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.13.2" } }, "nbformat": 4, "nbformat_minor": 0 }