First off, a few nods. I came across this thread on Stack Overflow.

The original script came from Gunther Struyf and is available at GitHub.

Oleg Komarov added a few more bells and whistles and posted it to the MATLAB file exchange .

I used a bit from both of these to create my own version (available in the Visualization package on the downloads page).

My main contributions were to generaize the type of values that can be passed in (can now take any values), as well as allowing for careful control over colormaps, and color ranges for the resulting plot.

Use example:

% Generate some random data.
r = (rand(20,20)-.5)*2;
% Threshold the data however you would like.
r(r>-.75 & r<.75)=NaN;
% Specify some labels if lbls is empty the script will auto-generate numeric labels
lbls = cellstr(num2str((1:20)'));
% Set the color limits, these represent the minimum and maximum values represented by the color scale
clims = [-1 1];
% Set the color map here it is magenta through black to yellow
colmap = 'mby'; % see col map for options
% set the rendering option
opt = 2; % Modifies exponent of bezier curves to better show local connections, but is a bit slower to run.
% specify groupings of variables (must be contiguous) or can be left blank
sets = [];
figure(20); clf;
% Generate the Schema Ball
h = SchemaBall(r, lbls, clims,colmap,opt,sets);

% Here's another example. showing only positive values with a yellow colorscale
r = rand(20,20);
% Specify four groupings of variables
sets = {1:5 6:10 11:15 16:20};
colmap = 'yellow2';
clims = [.5 1];
figure(21); clf;
h = SchemaBall(r, lbls, clims,colmap,opt,sets);

That’s it. This is quickly becoming my favorite visualization tool for showing correlation matrices which makes it ideal for showing functional connectivity graphs. Since the tool can plot any values it can also be used to represent statistical values such as the relationship between cognitive performance and the connectivity between multiple regions. Check out the CIRCOS page from some inspiration about how this style of visualization can be used.

Share this page: