5 Steps to Beautiful Stacked Area Charts in Python

How use the full capabilities of Matplotlib to tell a more compelling story

Guillaume Weingertner
Towards Data Science
Production by Source in the US — Image by Author

Telling a compelling story with data gets way easier when the charts supporting this very story are clear, self-explanatory and visually pleasing to the audience.

In many cases, substance and form are equally important.
Great data poorly presented will not catch the attention it deserves while poor data presented in a slick way will easily be discredited.

I hope this will resonate with many Data , or who had to present a chart in front an audience once in their lifetime.

Matplotlib makes it quick and easy to plot data with off-the-shelf functions but the tuning steps take more effort.
I spent quite some time researching to build compelling charts with Matplotlib, so you don’t have to.

In this article I focus stacked area charts and explain how I stitched together the bits of knowledge I found here and there to go from this…

… to that:

All images, unless otherwise noted, are by the author.

To illustrate the methodology, I used a public dataset containing details about how the US are producing their electricity and which can be found here — https://ourworldindata.org/electricity-mix.

On top of being a great dataset to illustrate stacked area charts, I also found it very insightful.

Source: Ember — Yearly Electricity Data (2023); Ember — Electricity Review (2022); Energy Institute — Statistical Review of Energy (2023)
License URL:
https://creativecommons.org/licenses/by/4.0/
License Type: CC BY-4.0

Source link