.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "plot_types/basic/stackplot.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. meta:: :keywords: codex .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_plot_types_basic_stackplot.py: =============== stackplot(x, y) =============== See `~matplotlib.axes.Axes.stackplot` .. GENERATED FROM PYTHON SOURCE LINES 7-28 .. image-sg:: /plot_types/basic/images/sphx_glr_stackplot_001.png :alt: stackplot :srcset: /plot_types/basic/images/sphx_glr_stackplot_001.png, /plot_types/basic/images/sphx_glr_stackplot_001_2_00x.png 2.00x :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data x = np.arange(0, 10, 2) ay = [1, 1.25, 2, 2.75, 3] by = [1, 1, 1, 1, 1] cy = [2, 1, 2, 1, 2] y = np.vstack([ay, by, cy]) # plot fig, ax = plt.subplots() ax.stackplot(x, y) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() .. _sphx_glr_download_plot_types_basic_stackplot.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: stackplot.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: stackplot.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_