sankey plot

sankey plot /sankey diagram /sankey chart

您现在正在关注此提交

Basic usage - links
links={'a1','A',1.2;'a2','A',1;'a1','B',.6;'a3','A',1; 'a3','C',0.5;
'b1','B',.4; 'b2','B',1;'b3','B',1; 'c1','C',1;
'c2','C',1; 'c3','C',1;'A','AA',2; 'A','BB',1.2;
'B','BB',1.5; 'B','AA',1.5; 'C','BB',2.3; 'C','AA',1.2};
% Create a Sankey diagram object
% 创建桑基图对象
SK = SSankey(links(:,1), links(:,2), links(:,3));
% Start drawing
% 开始绘图
SK.draw()
Basic usage - adjMat
% Define inter-layer adjacency matrices
% 定义层间邻接矩阵
A12 = [1,2,1; 1,2,3; 2,0,1];
A23 = [1,4; 2,1; 0,3];
A34 = [1,5; 2,3];
% Assemble global block matrix (main diagonal = zero, super-diagonal = A12, A23, A34)
% 组装全局分块矩阵(主对角线为零,上对角线为 A12, A23, A34)
adjMat = mergeAdjMat({A12, A23, A34});
SK = SSankey([],[],[], 'AdjMat',adjMat);
SK.draw()
The compressed package contains numerous usage examples.

引用格式

Zhaoxu Liu / slandarer (2026). sankey plot (https://ww2.mathworks.cn/matlabcentral/fileexchange/128679-sankey-plot), MATLAB Central File Exchange. 检索时间: .

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
6.0.3

Update README.md

6.0.2

Create sankeyDemo0 to show equivalent code.

6.0.1

More detailed error messages for function `mergeAdjMat` have been added.

6.0.0

The globalAdj = mergeAdjMat(layerAdj) function is introduced to create global adjacency matrices. Additionally, three new examples, sankeDemo16 to sankeDemo18, are added.

5.1.0

# version 5.1.0
+ 调整每一层标签位置(Set label location for each layer)
try : obj.setLabelLocation(1, 'left')

5.0.0

+ 左键添加数据提示框,右键隐藏高亮
Left-click to add data tooltip, right-click to hide highlight

4.0.0

+ 增添节点及链接(Add node and link)
try : obj.addNode(name,layer)
try : obj.addLink(source,target,value)

3.1.1

add demo image

3.1.0

% # update 3.1.0(2024-05-15)
see sankeyDemo12.m sankeyDemo13.m
+ 为链接添加显示数值的文本(Display value labels for each link)
try :
SK.ValueLabelLocation='left';

3.0.0

# update 3.0.0(2024-04-15)
+ 通过邻接矩阵创建桑基图(Creating a Sankey diagram through adjacency matrix)
+ 每层情况可被设置(Each layer state can be set)
+ 每个节点可在x方向上位移(Each node can be displaced in the x-direction)

2.0.1

+ Draw a chord-type-sankey-plot with chords flowing towards oneself 【see sankeyDemo6_2.m】

2.0.0

# update 2.0.0(2024-02-04)
see natureSankeyDemo1.m

+ 层向右对齐(Align layers to the right)
try : obj.LayerOrder='reverse';

+ 单独调整每层间隙大小(Adjust the Sep size of each layer separately)
try : obj..Sep=[.2,.06,.05,.07,.07,.08,.15];

1.0.0