<jupyter_start><jupyter_text>Stackplot DemoHow to create stackplots with Matplotlib.Stackplots are generated by plotting different datasets vertically ontop of one another rather than overlapping with one another. Below weshow some examples to accomplish this with Matplotlib.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y1 = [1, 1, 2, 3, 5]
y2 = [0, 4, 2, 6, 8]
y3 = [1, 3, 5, 7, 9]

y = np.vstack([y1, y2, y3])

labels = ["Fibonacci ", "Evens", "Odds"]

fig, ax = plt.subplots()
ax.stackplot(x, y1, y2, y3, labels=labels)
ax.legend(loc='upper left')
plt.show()

fig, ax = plt.subplots()
ax.stackplot(x, y)
plt.show()<jupyter_output><empty_output><jupyter_text>Here we show an example of making a streamgraph using stackplot<jupyter_code>def layers(n, m):
    """
    Return *n* random Gaussian mixtures, each of length *m*.
    """
    def bump(a):
        x = 1 / (.1 + np.random.random())
        y = 2 * np.random.random() - .5
        z = 10 / (.1 + np.random.random())
        for i in range(m):
            w = (i / m - y) * z
            a[i] += x * np.exp(-w * w)
    a = np.zeros((m, n))
    for i in range(n):
        for j in range(5):
            bump(a[:, i])
    return a


d = layers(3, 100)

fig, ax = plt.subplots()
ax.stackplot(range(100), d.T, baseline='wiggle')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15457875457875458, 'fraction_numerical': 0.03223443223443224, 'mean_word_length': 3.0414201183431953, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '266868', 'license': 'MIT', 'n_tokens_mistral': 557, 'n_tokens_neox': 520, 'n_words': 162, 'path': 'matplotlib/gallery_jupyter/lines_bars_and_markers/stackplot_demo.ipynb', 'repo_name': 'kingreatwill/penter', 'size': '1365'}