{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# stackplot(x, y)\nDraw a stacked area plot or a streamgraph.\n\nSee `~matplotlib.axes.Axes.stackplot`\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\nplt.style.use('_mpl-gallery')\n\n# make data\nx = np.arange(0, 10, 2)\nay = [1, 1.25, 2, 2.75, 3]\nby = [1, 1, 1, 1, 1]\ncy = [2, 1, 2, 1, 2]\ny = np.vstack([ay, by, cy])\n\n# plot\nfig, ax = plt.subplots()\n\nax.stackplot(x, y)\n\nax.set(xlim=(0, 8), xticks=np.arange(1, 8),\n ylim=(0, 8), yticks=np.arange(1, 8))\n\nplt.show()" ] } ], "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 }