It is pretty easy to draw chord chart by MATLAB!!
Zhaoxu Liu / slandarer
on 5 Feb 2024
Latest activity Reply by Zhaoxu Liu / slandarer
on 6 Feb 2024
I have written two tools and uploaded fileexchange, which allows us to easily draw chord diagrams:
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/25481/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/25486/image.png)
chord chart 弦图
download:
demo:
dataMat=[2 0 1 2 5 1 2;
3 5 1 4 2 0 1;
4 0 5 5 2 4 3];
dataMat=dataMat+rand(3,7);
dataMat(dataMat<1)=0;
colName={'G1','G2','G3','G4','G5','G6','G7'};
rowName={'S1','S2','S3'};
CC=chordChart(dataMat,'rowName',rowName,'colName',colName);
CC=CC.draw();
CC.setFont('FontSize',17,'FontName','Cambria')
% 显示刻度和数值
% Displays scales and numeric values
CC.tickState('on')
CC.tickLabelState('on')
% 调节标签半径
% Adjustable Label radius
CC.setLabelRadius(1.4);
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/25491/image.png)
Digraph chord chart 有向弦图
download:
demo:
dataMat=randi([0,8],[6,6]);
% 添加标签名称
NameList={'CHORD','CHART','MADE','BY','SLANDARER','MATLAB'};
BCC=biChordChart(dataMat,'Label',NameList,'Arrow','on');
BCC=BCC.draw();
% 添加刻度
BCC.tickState('on')
% 修改字体,字号及颜色
BCC.setFont('FontName','Cambria','FontSize',17,'Color',[.2,.2,.2])
BCC.setLabelRadius(1.3);
BCC.tickLabelState('on')
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/25496/image.png)
5 Comments
The chord File Exchange projects is great! Last week, File Exchange added support to have projects opened directly in MATLAB Online. If you add an example file, people can see the example in MATLAB Online.
Not only are these terrific tools but it's also an outstanding "Tips and Tricks" discussion.
I'm interested to see examples of MATLAB users creating chord charts and hearing about its application and use-case.