{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# stem(x, y)\nCreate a stem plot.\n\nSee `~matplotlib.axes.Axes.stem`.\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 = 0.5 + np.arange(8)\ny = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0]\n\n# plot\nfig, ax = plt.subplots()\n\nax.stem(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 }