Overview
Sankey diagrams in Sirena visualize flow quantities between nodes, where the width of arrows or connections is proportional to the flow rate. Sankey diagrams are ideal for showing how quantities move through a system, making them excellent for energy flows, material flows, cost distributions, and other transfer visualizations.
Sankey diagrams are useful for:
-
Visualizing energy flows in systems
-
Showing material flows in manufacturing processes
-
Illustrating budget allocations and spending
-
Mapping website traffic flows
-
Displaying data transfer in networks
-
Representing ecological cycles and resource flows
Syntax specification
Diagram declaration
Sankey diagrams are declared using the sankey-beta keyword:
sankey-beta
<diagram-content>
Examples
Simple Sankey diagram
sankey-beta
A,B,10
B,C,20
A,D,5
This creates a simple Sankey diagram showing flows from node A to nodes B and D, and from B to C. The flow widths are proportional to the values.
Sankey with node labels
sankey-beta
Source [Energy Source]
Process [Processing Plant]
Output [Useful Energy]
Waste [Waste Heat]
Source,Process,100
Process,Output,70
Process,Waste,30
This demonstrates energy flow through a processing plant with custom labels for nodes.
Complex flow network
sankey-beta
A,B,10
A,C,5
B,D,8
B,E,2
C,D,3
C,F,2
This shows a more complex network where flows split and merge across multiple paths.
Budget allocation example
sankey-beta
Revenue [Total Revenue],Operations,60
Revenue,Marketing,25
Revenue,Research,15
Operations,Salaries,40
Operations,Infrastructure,20
Marketing,Digital,15
Marketing,Events,10
Research,Development,10
Research,Innovation,5
This demonstrates using Sankey diagrams for visualizing budget allocations across departments and categories.
Features
Proportional flow widths
The width of each flow path is automatically calculated proportional to its value:
-
Larger values result in wider flow paths
-
Smaller values result in narrower flow paths
-
Visual width helps quickly identify major vs minor flows
Automatic node discovery
Nodes are automatically discovered from flow definitions:
sankey-beta
A,B,10
B,C,20
Creates three nodes (A, B, C) automatically without explicit declaration.
Best practices
Choose meaningful node IDs
Use descriptive node identifiers:
%% Good
Solar,Battery,100
Battery,Home,80
%% Less clear
A,B,100
B,C,80
Balance your flows
For physically meaningful diagrams, ensure conservation of flow:
%% Good - balanced flows
Input,Process,100
Process,Output,70
Process,Waste,30 %% 70 + 30 = 100
%% Unbalanced - may be intentional or an error
Input,Process,100
Process,Output,120 %% Where did extra 20 come from?
Use appropriate value scales
Choose flow values that represent the actual quantities:
-
Energy: use Watts, kWh, etc.
-
Materials: use tons, kg, liters, etc.
-
Money: use currency amounts
-
Data: use bytes, packets, etc.
Rendering behavior
Flow width calculation
Flow widths are calculated as:
-
Proportional to the flow value
-
Scaled between minimum and maximum widths
-
The largest flow gets the maximum width
-
The smallest flow gets the minimum width
Limitations
Use cases
Energy systems
Visualizing energy production, conversion, and consumption:
sankey-beta
Coal,Electricity,40
Gas,Electricity,30
Solar,Electricity,20
Wind,Electricity,10
Electricity,Residential,30
Electricity,Commercial,40
Electricity,Industrial,30