Monday, 23 September 2013

Sankey Diagrams

Sankey Diagrams are useful for showing flows, such as energy flows or movements of people. My favourite example is the Energy Flow Chart, produced annually by the UK's Department of Energy and Climate Change.
Versions of the chart going back to 1974 are available from the National Archives. It's interesting to see the shift from coal to gas and the reduction in energy consumption by industry over this period. Note that different units are used in the 1974 and 2012 charts; 1 toe equals approximately 397 therms (DUKES 2013 page 229). 
DUKES Annex H includes detailed flow charts for individual fuels.

There's an entire blog on Sankey diagrams at, which is useful for inspiration and for advice on design. The site includes a list of software for creating the diagrams.

The D3 Sankey plugin is fairly easy to use if you know some JavaScript; see Mike Bostock's example. The 2012 UK flow chart (above) was created in Adobe InDesign.


  1. There's actually quite an easy route to d3.js powered sankey diagrams via the R rcharts library (and maybe a plugin to it?). See for example

  2. Hi Tony
    Thanks for sharing the link. That looks very useful, as does the Open Refine tool that you use. Learning more about cleaning and shaping data is on my to-do list, so I'll check Open Refine out.
    I also came across a site that shows how to create a D3 Sankey diagram from Excel, but I haven't tried it out:

  3. HI James -I think Bruce sometimes does Excel versions of recipes I post?;-)

    Re: OpenRefine - I find it a really useful tool for reshaping and transforming data; you can also use it to pull in things from URLs, which can make harvesting data easier in some cases. There are several tutorial/walthroughs putting it through its paces on the School of Data blog:

  4. This comment has been removed by a blog administrator.

  5. Try You can make sankeys right from your spreadsheets.

  6. Hi James, for those that would like to create Sankey diagrams without code, I have created which automatically creates Sankey diagrams, with arrows from a simple Tab separated file. It's the only tool on the Internet where you can create Sankey diagrams and save the settings for a future visit. It has a host of features like the exclusive Node Lock that allows the user to move Nodes and the connected Links to change the grouping and then Lock and Save those positions for a future visit. Try the Free account at (as seen in Wikipedia as the first ever web based SankeyBuilder! Enjoy! Rob