SankeyDiagram

New in version 5.0.10

SankeyDiagram ( appearanceConst ;​ nodeWidth ;​ nodePadding ;​ linkPadding ;​ alignment )

Argument Type Range Default Note
appearanceConst int 0..127 default
nodeWidth num 0..10000 5%
nodePadding num 0..10000 2%
linkPadding num 0..10000 0%
alignment int 1..4 1
Examples

SankeyDiagram(label;​20)

SankeyDiagram(label;​4%;​0)

SankeyDiagram(label;​;​10;​0.5%;​4)

Description

The SankeyDiagram() function makes it possible to create various kind of Sankey flow diagrams. Function SankeyDiagram() should always be listed first before other Sankey functions are called.
The 1st argument appearanceConstants can be used to add labels to nodes and links. Currently only the appearance constant label is supported. By using the 2nd argument nodeWidth, the width of the entities (nodes) can be controlled. The width is to be entered absolute in pixels or in percent of the plot area.

SANKEY_DIAGRAM_01
1

OpenDrawing(300;​200)

2

SankeyDiagram(label) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(2;​"A" "X" 5;​ "A" "Y" 7;​ "A" "Z" 6;​ "B" "X" 2;​ "B" "Y" 9;​ "B" "Z" 4)

4

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

5

CloseDrawing()

SANKEY_DIAGRAM_01
SANKEY_DIAGRAM_02
1

OpenDrawing(300;​200)

2

SankeyDiagram(label;​25) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(2;​"A" "X" 5;​ "A" "Y" 7;​ "A" "Z" 6;​ "B" "X" 2;​ "B" "Y" 9;​ "B" "Z" 4)

4

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

5

CloseDrawing()

SANKEY_DIAGRAM_02

The 3rd argument nodePadding can be used to control the vertical padding between nodes (absolute in pixels or in percent of the plot area).

SANKEY_DIAGRAM_03
1

OpenDrawing(300;​200)

2

SankeyDiagram(label;​20;​0) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(2;​"A" "X" 5;​ "A" "Y" 7;​ "A" "Z" 6;​ "B" "X" 2;​ "B" "Y" 9;​ "B" "Z" 4)

4

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

5

CloseDrawing()

SANKEY_DIAGRAM_03
SANKEY_DIAGRAM_04
1

OpenDrawing(300;​200)

2

SankeyDiagram(label;​20;​16) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(2;​"A" "X" 5;​ "A" "Y" 7;​ "A" "Z" 6;​ "B" "X" 2;​ "B" "Y" 9;​ "B" "Z" 4)

4

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

5

CloseDrawing()

SANKEY_DIAGRAM_04

As an option, a gap can be added between nodes and links by using the 4th argument linkPadding (absolute in pixels or in percent of the plot area).

SANKEY_DIAGRAM_05
1

OpenDrawing(300;​200)

2

SankeyDiagram(label;​20;​8;​1.5%) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(2;​"A" "X" 5;​ "A" "Y" 7;​ "A" "Z" 6;​ "B" "X" 2;​ "B" "Y" 9;​ "B" "Z" 4)

4

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

5

CloseDrawing()

SANKEY_DIAGRAM_05

For complex multi-layered Sankey diagrams, i.e. diagrams with more than 2 layers (columns), the alignment of the nodes and layers can be controlled by the 5th argument alignment. Four alignment options are available for this. If alignment is not defined, alignment =​ 1 (left) is used by default.

alignment =​ 1: Left, for example:

SANKEY_DIAGRAM_06
1

OpenDrawing(900;​600)

2

SankeyDiagram(label;​12;​;​;​1) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(3;​

4

"Agricultural 'waste'" "Bio-conversion" "Liquid" "Losses" "Solid" "Gas" "Biofuel imports" "Biomass imports" "Coal imports" "Coal" "Coal reserves" "District heating" "Industry" "Heating and cooling - commercial" "Heating and cooling - homes" "Electricity grid" "Over generation / exports" "H2 conversion" "Road transport" "Agriculture" "Rail transport" "Lighting & appliances - commercial" "Lighting & appliances - homes" "Gas imports" "Ngas" "Gas reserves" "Thermal generation" "Geothermal" "H2" "Hydro" "International shipping" "Domestic aviation" "International aviation" "National navigation" "Marine algae" "Nuclear" "Oil imports" "Oil" "Oil reserves" "Other waste" "Pumped heat" "Solar PV" "Solar Thermal" "Solar" "Tidal" "UK land based bioenergy" "Wave" "Wind";​

5

0 1 124.729;​ 1 2 0.597;​ 1 3 26.862;​ 1 4 280.322;​ 1 5 81.144;​ 6 2 35.000;​ 7 4 35.000;​ 8 9 11.606;​ 10 9 63.965;​ 9 4 75.571;​ 11 12 10.639;​ 11 13 22.505;​ 11 14 46.184;​ 15 16 104.453;​ 15 14 113.726;​ 15 17 27.140;​ 15 12 342.165;​ 15 18 37.797;​ 15 19 4.412;​ 15 13 40.858;​ 15 3 56.691;​ 15 20 7.863;​ 15 21 90.008;​ 15 22 93.494;​ 23 24 40.719;​ 25 24 82.233;​ 5 13 0.129;​ 5 3 1.401;​ 5 26 151.891;​ 5 19 2.096;​ 5 12 48.580;​ 27 15 7.013;​ 17 28 20.897;​ 17 3 6.242;​ 28 18 20.897;​ 29 15 6.995;​ 2 12 121.066;​ 2 30 128.690;​ 2 18 135.835;​ 2 31 14.458;​ 2 32 206.267;​ 2 19 3.640;​ 2 33 33.218;​ 2 20 4.413;​ 34 1 4.375;​ 24 5 122.952;​ 35 26 839.978;​ 36 37 504.287;​ 38 37 107.703;​ 37 2 611.990;​ 39 4 56.587;​ 39 1 77.810;​ 40 14 193.026;​ 40 13 70.672;​ 41 15 59.901;​ 42 14 19.263;​ 43 42 19.263;​ 43 41 59.901;​ 4 19 0.882;​ 4 26 400.120;​ 4 12 46.477;​ 26 15 525.531;​ 26 3 787.129;​ 26 11 79.329;​ 44 15 9.452;​ 45 1 182.010;​ 46 15 19.013;​ 47 15 289.366)

6

SankeyDiagramNodeColorScheme(5;​shaded)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

AddText(20;​590;​"Source: Tom Counsell, Energy forecast for 2050, UK Department of Energy & Climate Change.")

9

CloseDrawing()

SANKEY_DIAGRAM_06

alignment =​ 2: Center, for example:

SANKEY_DIAGRAM_07
1

OpenDrawing(900;​600)

2

SankeyDiagram(label;​12;​;​;​2) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(3;​

4

"Agricultural 'waste'" "Bio-conversion" "Liquid" "Losses" "Solid" "Gas" "Biofuel imports" "Biomass imports" "Coal imports" "Coal" "Coal reserves" "District heating" "Industry" "Heating and cooling - commercial" "Heating and cooling - homes" "Electricity grid" "Over generation / exports" "H2 conversion" "Road transport" "Agriculture" "Rail transport" "Lighting & appliances - commercial" "Lighting & appliances - homes" "Gas imports" "Ngas" "Gas reserves" "Thermal generation" "Geothermal" "H2" "Hydro" "International shipping" "Domestic aviation" "International aviation" "National navigation" "Marine algae" "Nuclear" "Oil imports" "Oil" "Oil reserves" "Other waste" "Pumped heat" "Solar PV" "Solar Thermal" "Solar" "Tidal" "UK land based bioenergy" "Wave" "Wind";​

5

0 1 124.729;​ 1 2 0.597;​ 1 3 26.862;​ 1 4 280.322;​ 1 5 81.144;​ 6 2 35.000;​ 7 4 35.000;​ 8 9 11.606;​ 10 9 63.965;​ 9 4 75.571;​ 11 12 10.639;​ 11 13 22.505;​ 11 14 46.184;​ 15 16 104.453;​ 15 14 113.726;​ 15 17 27.140;​ 15 12 342.165;​ 15 18 37.797;​ 15 19 4.412;​ 15 13 40.858;​ 15 3 56.691;​ 15 20 7.863;​ 15 21 90.008;​ 15 22 93.494;​ 23 24 40.719;​ 25 24 82.233;​ 5 13 0.129;​ 5 3 1.401;​ 5 26 151.891;​ 5 19 2.096;​ 5 12 48.580;​ 27 15 7.013;​ 17 28 20.897;​ 17 3 6.242;​ 28 18 20.897;​ 29 15 6.995;​ 2 12 121.066;​ 2 30 128.690;​ 2 18 135.835;​ 2 31 14.458;​ 2 32 206.267;​ 2 19 3.640;​ 2 33 33.218;​ 2 20 4.413;​ 34 1 4.375;​ 24 5 122.952;​ 35 26 839.978;​ 36 37 504.287;​ 38 37 107.703;​ 37 2 611.990;​ 39 4 56.587;​ 39 1 77.810;​ 40 14 193.026;​ 40 13 70.672;​ 41 15 59.901;​ 42 14 19.263;​ 43 42 19.263;​ 43 41 59.901;​ 4 19 0.882;​ 4 26 400.120;​ 4 12 46.477;​ 26 15 525.531;​ 26 3 787.129;​ 26 11 79.329;​ 44 15 9.452;​ 45 1 182.010;​ 46 15 19.013;​ 47 15 289.366)

6

SankeyDiagramNodeColorScheme(5;​shaded)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

AddText(20;​590;​"Source: Tom Counsell, Energy forecast for 2050, UK Department of Energy & Climate Change.")

9

CloseDrawing()

SANKEY_DIAGRAM_07

alignment =​ 3: Right, for example:

SANKEY_DIAGRAM_08
1

OpenDrawing(900;​600)

2

SankeyDiagram(label;​12;​;​;​3) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(3;​

4

"Agricultural 'waste'" "Bio-conversion" "Liquid" "Losses" "Solid" "Gas" "Biofuel imports" "Biomass imports" "Coal imports" "Coal" "Coal reserves" "District heating" "Industry" "Heating and cooling - commercial" "Heating and cooling - homes" "Electricity grid" "Over generation / exports" "H2 conversion" "Road transport" "Agriculture" "Rail transport" "Lighting & appliances - commercial" "Lighting & appliances - homes" "Gas imports" "Ngas" "Gas reserves" "Thermal generation" "Geothermal" "H2" "Hydro" "International shipping" "Domestic aviation" "International aviation" "National navigation" "Marine algae" "Nuclear" "Oil imports" "Oil" "Oil reserves" "Other waste" "Pumped heat" "Solar PV" "Solar Thermal" "Solar" "Tidal" "UK land based bioenergy" "Wave" "Wind";​

5

0 1 124.729;​ 1 2 0.597;​ 1 3 26.862;​ 1 4 280.322;​ 1 5 81.144;​ 6 2 35.000;​ 7 4 35.000;​ 8 9 11.606;​ 10 9 63.965;​ 9 4 75.571;​ 11 12 10.639;​ 11 13 22.505;​ 11 14 46.184;​ 15 16 104.453;​ 15 14 113.726;​ 15 17 27.140;​ 15 12 342.165;​ 15 18 37.797;​ 15 19 4.412;​ 15 13 40.858;​ 15 3 56.691;​ 15 20 7.863;​ 15 21 90.008;​ 15 22 93.494;​ 23 24 40.719;​ 25 24 82.233;​ 5 13 0.129;​ 5 3 1.401;​ 5 26 151.891;​ 5 19 2.096;​ 5 12 48.580;​ 27 15 7.013;​ 17 28 20.897;​ 17 3 6.242;​ 28 18 20.897;​ 29 15 6.995;​ 2 12 121.066;​ 2 30 128.690;​ 2 18 135.835;​ 2 31 14.458;​ 2 32 206.267;​ 2 19 3.640;​ 2 33 33.218;​ 2 20 4.413;​ 34 1 4.375;​ 24 5 122.952;​ 35 26 839.978;​ 36 37 504.287;​ 38 37 107.703;​ 37 2 611.990;​ 39 4 56.587;​ 39 1 77.810;​ 40 14 193.026;​ 40 13 70.672;​ 41 15 59.901;​ 42 14 19.263;​ 43 42 19.263;​ 43 41 59.901;​ 4 19 0.882;​ 4 26 400.120;​ 4 12 46.477;​ 26 15 525.531;​ 26 3 787.129;​ 26 11 79.329;​ 44 15 9.452;​ 45 1 182.010;​ 46 15 19.013;​ 47 15 289.366)

6

SankeyDiagramNodeColorScheme(5;​shaded)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

AddText(20;​590;​"Source: Tom Counsell, Energy forecast for 2050, UK Department of Energy & Climate Change.")

9

CloseDrawing()

SANKEY_DIAGRAM_08

alignment =​ 4: Justify, for example:

SANKEY_DIAGRAM_09
1

OpenDrawing(900;​600)

2

SankeyDiagram(label;​12;​;​;​4) /* Function SankeyDiagram(...) is always listed first. */

3

SankeyDiagramData(3;​

4

"Agricultural 'waste'" "Bio-conversion" "Liquid" "Losses" "Solid" "Gas" "Biofuel imports" "Biomass imports" "Coal imports" "Coal" "Coal reserves" "District heating" "Industry" "Heating and cooling - commercial" "Heating and cooling - homes" "Electricity grid" "Over generation / exports" "H2 conversion" "Road transport" "Agriculture" "Rail transport" "Lighting & appliances - commercial" "Lighting & appliances - homes" "Gas imports" "Ngas" "Gas reserves" "Thermal generation" "Geothermal" "H2" "Hydro" "International shipping" "Domestic aviation" "International aviation" "National navigation" "Marine algae" "Nuclear" "Oil imports" "Oil" "Oil reserves" "Other waste" "Pumped heat" "Solar PV" "Solar Thermal" "Solar" "Tidal" "UK land based bioenergy" "Wave" "Wind";​

5

0 1 124.729;​ 1 2 0.597;​ 1 3 26.862;​ 1 4 280.322;​ 1 5 81.144;​ 6 2 35.000;​ 7 4 35.000;​ 8 9 11.606;​ 10 9 63.965;​ 9 4 75.571;​ 11 12 10.639;​ 11 13 22.505;​ 11 14 46.184;​ 15 16 104.453;​ 15 14 113.726;​ 15 17 27.140;​ 15 12 342.165;​ 15 18 37.797;​ 15 19 4.412;​ 15 13 40.858;​ 15 3 56.691;​ 15 20 7.863;​ 15 21 90.008;​ 15 22 93.494;​ 23 24 40.719;​ 25 24 82.233;​ 5 13 0.129;​ 5 3 1.401;​ 5 26 151.891;​ 5 19 2.096;​ 5 12 48.580;​ 27 15 7.013;​ 17 28 20.897;​ 17 3 6.242;​ 28 18 20.897;​ 29 15 6.995;​ 2 12 121.066;​ 2 30 128.690;​ 2 18 135.835;​ 2 31 14.458;​ 2 32 206.267;​ 2 19 3.640;​ 2 33 33.218;​ 2 20 4.413;​ 34 1 4.375;​ 24 5 122.952;​ 35 26 839.978;​ 36 37 504.287;​ 38 37 107.703;​ 37 2 611.990;​ 39 4 56.587;​ 39 1 77.810;​ 40 14 193.026;​ 40 13 70.672;​ 41 15 59.901;​ 42 14 19.263;​ 43 42 19.263;​ 43 41 59.901;​ 4 19 0.882;​ 4 26 400.120;​ 4 12 46.477;​ 26 15 525.531;​ 26 3 787.129;​ 26 11 79.329;​ 44 15 9.452;​ 45 1 182.010;​ 46 15 19.013;​ 47 15 289.366)

6

SankeyDiagramNodeColorScheme(5;​shaded)

7

SankeyDiagramNodeLabel(;​auto;​"{NODE_ID}")

8

AddText(20;​590;​"Source: Tom Counsell, Energy forecast for 2050, UK Department of Energy & Climate Change.")

9

CloseDrawing()

SANKEY_DIAGRAM_09

Please note that title functions such as TitleText(), TitleStyle(), etc. are ignored in combination with Sankey diagrams, use function AddText() instead.

Scroll to Top