Using pandas library, the stacked area charts are plotted with the plot.area() function. Each column of your data frame will be plotted as an area on the chart.

# libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Dataset
df = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c', 'd'])
# plot

# show the graph


Contact & Edit

👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥

This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!