Category: General

Sankey Diagram using TikZ

Over at the TeX – LaTeX Stack Exchange (a Q&A site for users of TeX and LaTeX) this article explains “How to draw a Sankey Diagram using TikZ”. Okay, its a bit techie, but the results look good.

The original poster wanted to know how to draw a Sankey diagram using the TikZ package (TikZ is a “higher-level drawing language built on top of the PGF graphics framework”).

User Paul Gaborit came up with this example using TikZ and building his own sankeydiagram environment

The interesting thing is that flows can fork and join, and that there is a check that the sum of quantities must be equal to the quantity of sankey node to fork.

This is how the the original sample Sankey diagram looks like with this solution.

Very nice result. So for those out there used to working with TeX/LaTeX out this is actually a good solution.

Don’t miss to read the comments too (there’s one pointing to an alternative (Matplotlib and Sankey module).

U-turn Sankey arrows

This legacy article on ‘Solar Energy System and Design’ by W.B. Stine and R.W. Harrigan (published in 1985 already) has four Sankey diagrams for energy flows in a solar power system.

The old-school black&white Sankey diagrams depicted have a general vertical orientation, and some flows branch out to the left of the general flow direction. This is OK, but the first branch flow bends with an angle larger than 90° degrees, performing an almost U-turn.

In the next diagram this idea is doomed to fail as the Sankey arrow to the left is wider than the one going straight on, and the initial parallel segment is much too short.

Additionally in this second Sankey diagram the two arrows at the bottom don’t add up with their flow quantities correctly (633 kW + 244 kW is not 1008 kW).