Chord Diagram (Circular Plots)

This is a single function to plot unshaded chord diagrams: https://en.wikipedia.org/wiki/Chord_diagram
397 Downloads
Updated 17 Sep 2020

View License

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
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
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