Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone



A Sankey diagram is a specific type of flow diagram, in which the width of the links is shown proportionally to the flow quantity. Entities are represented by rectangles or text, and linked if there is a flow between them. It shows a directed network structure (with nodes

and edges), so other type of visualisation are probably possible for your data (like network, arc diagram, dendrogram, edge bundling..). Alluvial chart is a variation of sankey that visualizes frequency distributions over time or frequency tables involving

several categorical variables. It will be considered in this section as well. Concerning tools, my preference goes to the networkD3 library that allows to make interactive version of Sankeys. For static version, the alluvial and ggalluvial libraries are considered.




NetworkD3 library

The networkD3 library allows to draw interactive Network Graphs from R. One of its function makes stunning Sankey diagrams as shown below. The following charts teach how to make a basic one and how to customise it.

Chart #323: Sankey diagram with the NetworkD3 library (code)


Alluvial library



GGalluvial library




Search the gallery