Sankey diagrams: flows and links
简介 / Introduction
A Sankey diagram uses width-encoded flow lines to show how quantities move between nodes, making it ideal for energy distribution, website visitor paths, or budget flows. PlantUML has no native Sankey type; Mermaid v11 provides sankey-beta syntax. This post compares both approaches.
PlantUML 版
PlantUML has no built-in Sankey diagram, but you can approximate simple flow relationships using a class diagram + skinparam, with left to right direction for layout. The example below models material flow on a production line:
1 | @startuml |
PlantUML flows are plain arrows — they cannot directly express magnitude differences. You can simulate width variation with multiple arrows or post-process the rendered SVG, but there’s no native Sankey layout.
Mermaid 版
Mermaid v11’s sankey-beta is purpose-built for Sankey diagrams. Nodes are listed inside the chart, and flows are declared with --> where the number encodes the quantity:
1 | sankey-beta |
Note:
sankey-betais a beta syntax. Not all CDN-hosted mermaid bundles include it — confirm the editor is serving a mermaid.min.js that has thesankey-betaparser registered.
对比 / Side-by-side
| Feature | PlantUML | Mermaid sankey-beta |
|---|---|---|
| Native Sankey | No | Yes (beta) |
| Width encodes magnitude | No (arrows have no width) | Yes (number → width) |
| Node layout direction | left to right / top to bottom |
Automatic Sankey layout |
| Multi-path merging | Manual simulation | Automatic merge/split |
| Best for | Conceptual flowcharts | Data-flow analysis |
小结 / Wrap-up
If your goal is to show flow magnitude, Mermaid sankey-beta is the better fit — it auto-calculates flow widths and produces a data-rich visualization. If you only need to convey directional relationships without quantity encoding, PlantUML arrows work fine and keep your diagrams consistent with the rest of the project’s PlantUML set.
- Title: Sankey diagrams: flows and links
- Author: puml.online
- Created at : 2026-10-09 01:00:32
- Updated at : 2026-10-09 01:06:43
- Link: https://puml.online/blog/sankey-beta-flow-links-en/
- License: This work is licensed under CC BY-NC-SA 4.0.