Friday, September 25, 2026
HomeMatlabSankey diagrams in MATLAB

Sankey diagrams in MATLAB


Mike’s choose this week is sankey plot by Zhaoxu Liu / slandarer nominated by Yair Altman.
Sankey diagrams visualize flows, of power, cash, supplies, individuals, something that strikes from one place to a different, the place the width of every arrow is proportional to the amount flowing. In keeping with Wikipedia, Sankey diagrams are named after Irish Captain Matthew Henry Phineas Riall Sankey, who used any such diagram in 1898 in to point out the power effectivity of a steam engine.
slandarer’s file alternate entry brings these diagrams to MATLAB and they’re lovely! Listed here are a number of examples from the package deal taken from the 20+ included
hyperlinks={‘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};
 
SK = SSankey(hyperlinks(:,1), hyperlinks(:,2), hyperlinks(:,3));
SK.draw()
%% sankey demo20 :Rotate the Sankey diagram by 90 levels to make it vertical
determine(‘Identify’,‘sankey demo20’, ‘Models’,‘normalized’, ‘Place’,[.05,.1,.4,.7])
A12 = [1,2,1; 1,2,3; 5,0,1];
A23 = [1,4,2; 3,1,0; 0,3,2];
adjMat = mergeAdjMat({A12, A23});
SK = SSankey([],[],[], ‘AdjMat’,adjMat);
SK.NodeList = {‘AAA’,‘BBB’,‘CCC’,‘prop1’,‘prop2’,‘prop3’,‘set1’,‘set2’,‘set3’};
SK.RenderingMethod = ‘left’;
SK.ValueLabelLocation = ‘left’;
SK.ValueLabelFormat = @(X) [‘sample number=”,num2str(X)];
SK.ColorList = [ 36, 59, 90; 199, 49, 68; 161,137,111;
73, 84,114; 209, 90,105; 226,209,191;
30, 30, 30; 30, 30, 30; 30, 30, 30]./255;
SK.Align = “down’;
SK.draw()
SK.setLabelLocation(3, ‘proper’)
SK.setLink(1:15, ‘FaceAlpha’,.5)
 
% Rotate all the diagram to vertical orientation
rotateSankey(SK)
The package deal has been downloaded hundreds of occasions and slandarer has been very conscious of consumer requests within the discussions and evaluation sections of the file alternate entry resulting in a number of new variations because it’s first launch in 2023.

var css=”._richTextNode {white-space: break-spaces;}”; var head = doc.head || doc.getElementsByTagName(‘head’)[0], type = doc.createElement(‘type’); head.appendChild(type); type.kind=”textual content/css”; if (type.styleSheet){ type.styleSheet.cssText = css; } else { type.appendChild(doc.createTextNode(css)); }

RELATED ARTICLES

MATLAB on the Steam Deck

What’s New in R2026a?

Velvel Kahan

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

MATLAB on the Steam Deck

What’s New in R2026a?

Velvel Kahan

What really makes you senior

Recent Comments