Stacked area chart with seaborn style

logo of a chart:StackedArea

The previous post describes how to draw a basic stacked area chart with matplotlib. In this post, you will see an example of stacked area chart with a seaborn theme.

You can benefit the seaborn style in your graphs by calling the set_theme() function of seaborn library at the beginning of your code:

# libraries
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# set seaborn style
sns.set_theme()
 
# Data
x=range(1,6)
y=[ [1,4,6,8,9], [2,2,7,10,12], [2,8,5,10,6] ]
 
# Plot
plt.stackplot(x,y, labels=['A','B','C'])
plt.legend(loc='upper left')
plt.show()

Timeseries

🚨 Grab the Data To Viz poster!


Do you know all the chart types? Do you know which one you should pick? I made a decision tree that answers those questions. You can download it for free!

    dataviz decision tree poster