A streamgraph is a variation of the stacked area graph. It displays the evolution of a numeric value for several groups. Each group is displayed around a central axis and edges are rounded resulting in a flowing and organic shape.

Matplotlib logoStreamgraph with Matplotlib

Matplotlib can build streamgraphs but there isn't any prebuilt function for it so be ready for quite a lot of code. 🍿

The process starts pretty much like for a stacked area graph. The baseline parameter of the stackplot() function is used to place groups around the X axis. The tricky part is to interpolate points between each value of the X axis to get the smooth visual. This is done thanks to the scipy.interpolate library.


👋 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! 🔥