Stack plot

plot 08 stackplot

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.

View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.

View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.

import numpy as np
import plotpress

rng = np.random.default_rng(2)
x = np.arange(10)
a, b, c = (np.abs(rng.normal(2, 0.6, 10)).cumsum() / 3 for _ in range(3))
fig, ax = plotpress.subplots()
ax.stackplot(x, a, b, c, labels=["A", "B", "C"])
ax.set_title("stackplot"); ax.legend()
fig.tight_layout()

Total running time of the script: (0 minutes 0.102 seconds)

Gallery generated by Sphinx-Gallery