[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/stable/api/_as_gen/../../plot_types/unstructured/../basic/stackplot.html [Back]  [Original]

stackplot(x, y) — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

stackplot(x, y)#

Draw a stacked area plot or a streamgraph.

See stackplot

stackplot [stackplot]
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()

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page