Streamgraph


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.

Streamgraph with Altair

Altair is a lesser know python library for datavizualization.

Fortunately, the pandas library has a divide() function that allows to apply this normalization easily.

💡 Stacked area chart as a workaround

It is important to note that the stackplot() function of matplotlib has abaseline parameter. This parameter controls how groups are displayed around the x axis, what allows to mimic a streamgraph.

Contact

👋 This document is a work by Yan Holtz. Any feedback is highly encouraged. You can fill an issue on Github, drop me a message onTwitter, or send an email pasting yan.holtz.data with gmail.com.

Violin

Density

Histogram

Boxplot

Ridgeline

Scatterplot

Heatmap

Correlogram

Bubble

Connected Scatter

2D Density

Barplot

Spider / Radar

Wordcloud

Parallel

Lollipop

Circular Barplot

Treemap

Venn Diagram

Donut

Pie Chart

Dendrogram

Circular Packing

Line chart

Area chart

Stacked Area

Streamgraph

Map

Choropleth

Hexbin

Cartogram

Connection

Bubble

Chord Diagram

Network

Sankey

Arc Diagram

Edge Bundling

Colors

Interactivity

Animation with python

Animation

Cheat sheets

Caveats

3D