Plotly stacked area chart

In this Plotly tutorial, you will learn how to plot a stacked area chart in Python. You can use px.area() function for this task.

# Import Plotly Module
import plotly.express as px

# Import Dataset
dataset = px.data.gapminder().query("continent=='Oceania'")

# Stacked Area Chart
plot = px.area(dataset, x="country", y="pop", color="year", line_group="year")

# Show the Plot
plot.show()

Output:

Plotly stacked area chart

Free learning resources: AiHintsCodeAllow

Leave a Comment

Your email address will not be published.