SankeyMATIC Gallery: Energy Flows

Reworking a complex example

Back to Gallery Home

Energy flows, revised diagram

Original Diagram


Sankey energy example: Original

Notes from the original:

Source: Department of Energy & Climate Change, Tom Counsell.

“This intricate diagram shows a possible scenario for UK energy production and consumption in 2050: energy supplies are on the left, and demands are on the right.

Intermediate nodes group related forms of production and show how energy is converted and transmitted before it is consumed (or lost!).”

This dataset is used in the big library of D3 examples as a demonstration of D3's Sankey capabilities.

I have adapted the original inputs (found here) to be in SankeyMATIC format (shown below).

Some of the formatting changes I experimented with:

  • Nodes are no longer multicolored. (I found the wide assortment of node colors distracting.)

  • Nodes are narrower—just enough width to establish how large each is, and no more. This allows more room for the label text.

  • Since the labels had room to grow, I made them slightly larger & easier to read. (I did try displaying the node totals in the labels, but the amounts didn't fit in a diagram this size; in many places they overlapped other nodes.)

  • After removing most of the color, it is easier to highlight specific flows. In this rendition of the diagram I chose to call out the “Losses” node and the flows into it. With SankeyMATIC this only takes one extra line in the source data:

    :Losses #900 <<

One interesting oddity about this diagram - when you enter all the original inputs (shown at right) into SankeyMATIC, several flows are called out as imbalanced:

About this diagram

68 Flows between 48 Nodes. Total Inputs: 2,840.703. Total Outputs: 2,842.038
Total InTotal OutDifference
District heating79.32979.3280.001
Electricity grid917.271918.607-1.336
H2 conversion27.14027.1390.001

Regarding all the +/- 0.001 TWh differences: those are at the limit of the input data's precision and are easily considered rounding errors and not very important.

The more interesting line is the “Electricity grid” imbalance, which is noticeably larger.

I've put a little effort into trying to dig up the original data, but haven't been successful in pinning down what may be missing. My theory is that since these are all projections, it's possible there was a slight miscalculation in the original spreadsheet.

Whatever the source, the error is still quite small: 0.15% of the total size of the “Electricity grid” node. The fact that the IN amount is less than the OUT amount by 1.336 TWh is hardly even visible at this diagram size.


  • SankeyMATIC will tell you when there is an imbalance of any size in your diagram.

  • When the imbalance is greater than the limit of the input data's precision (0.001 here) and therefore potentially significant, the warning message will emphasize the amount to make it stand out from the other lines.

  • SankeyMATIC will render whatever it is able to, despite any imbalances.

See the Manual for more specific examples, or
return to the Gallery home page, or
go forth and try out a diagram of your own.