Chord Diagram (Circular Plots)
Easily plot chord diagrams to show relationship between groups. Place this function in your workspace to use.
function p = chordPlot(groups, connectionTable)
%%% Plot chord diagram
%%% Inputs:
%%% groups - One dimensional vector or cell array containing group names to be plotted around the chord diagram
%%% connectionTable - An n-by-2, or n-by-3, or n-by-4 table where columns one and two contain the groups to be connected and the
%%% third column are the weights for each connection, which are converted to line weights. The 4th
%%% column is the sign of the relationship, used for creating a gradient line between
%%% node.
%%% If you want all lines to be of equal weight, turn
%%% third column into a column of ones. If you want all lines to be solid color, 4th column
%%% into a column of zeros. Use array2table
%%% or cell2table to convert arrays or cells to
%%% tables
%%%
%%% Plot properties can be changed after plotting by for example doing:
%%% p.MarkerSize = 5;
%%% p.NodeFontSize = 12;
%%%
%%%
%%% Example plot:
% % % groups = 1:10;
% % % connections(:,1) = randi(10,50,1);
% % % connections(:,2) = randi(10,50,1);
% % % connections(:,3) = 2*rand(50,1);
% % % connections(:,4) = sign((rand(50,1) > 0.5) - 0.5);
% % % connectionsT = array2table(connections);
% % % chordPlot(groups,connectionsT)
Cite As
Prashant Pandey (2025). Chord Diagram (Circular Plots) (https://in.mathworks.com/matlabcentral/fileexchange/77350-chord-diagram-circular-plots), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.2.1 | New cover image |
||
| 1.2 | Now supports color gradient lines to show relationship between groups. Input table can have 2, 3 or 4 columns |
||
| 1.1.1 | Changed cover photo |
||
| 1.1.0 | Made line weight linearly proportional to weights column. Input connections can be table only. |
||
| 1.0.2 | Wording |
||
| 1.0.1 | Added a cover figure |
||
| 1.0.0 |
