File Exchange

okomarov/schemaball

version 1.1.0.0 (318 KB) by Oleg Komarov

Oleg Komarov (view profile)

Plot correlation matrix as a schemaball

Updated 16 Feb 2017

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Plots correlation matrix as a schemaball.
EXAMPLES:

- Base demo
schemaball

- Supply your own correlation matrix (only lower off-diagonal triangular part is considered)
x = rand(10).^3;
x(:,3) = 1.3*mean(x,2);
schemaball(x)

- Supply custom labels as ['aa'; 'bb'; 'cc'; ...] or {'Hi','how','are',...}
schemaball(x, repmat(('a':'j')',1,2))
schemaball(x, {'Hi','how','is','your','day?', 'Do','you','like','schemaballs?','NO!!'})

- Customize curve colors
schemaball([],[],[1,0,1;1 1 0])

- Customize node color
schemaball([],[],[],[0,1,0])

- Customize manually other aspects
h = schemaball;
set(h.l(~isnan(h.l)), 'LineWidth',1.2)
set(h.s, 'MarkerEdgeColor','red','LineWidth',2,'SizeData',100)
set(h.t, 'EdgeColor','white','LineWidth',1)

For details see help

Cite As

Oleg Komarov (2020). okomarov/schemaball (https://github.com/okomarov/schemaball), GitHub. Retrieved .

Philipp Holz

Christoph Guem

Christoph Guem (view profile)

Very nice work! The degree of custumization is well defined.

Woonhee Kim

Luke X

Luke X (view profile)

Nice plot! The node colors adds a nice level of complexity.

Arun Kumar

Arun Kumar (view profile)

Bernardo Coutinho

Paolo Inglese

Paolo Inglese (view profile)

I'd like to change the node colors according to known categories, but can't figure out logic behind the 'CData' of the scatter plot part of the graph. E.g. with a 128X128 matrix:

h.s.CData(1,:) = [1 0 0] % Changes color of node # 101
h.s.CData(2,:) = [1 0 0] % Changes color of node # 97
h.s.CData(3,:) = [1 0 0] % Changes color of node # 100
h.s.CData(4,:) = [1 0 0] % Changes color of node # 26

Text seems to be in order, anybody know how to deal with the scatter plot?

Vitali Alexeev

Vitali Alexeev (view profile)

To plot on the white background, change the following two lines in schemaball.m file:

A) Change
ccolor = hsv2rgb([repmat(ccolor(1,1:2),N,1), linspace(ccolor(1,end),0,N)';
repmat(ccolor(2,1:2),N,1), linspace(0,ccolor(2,end),N)']);
To:
ccolor = hsv2rgb([repmat(ccolor(1,1),N,1), linspace(ccolor(1,end),0,N)', repmat(ccolor(1,3),N,1);
repmat(ccolor(2,1),N,1), linspace(0,ccolor(2,end),N)', repmat(ccolor(2,3),N,1)]);

B) Change ['color', 'k'] in
set(gca, 'Xlim',xlims,'Ylim',ylims, 'color', 'k','XColor','none','YColor','none',...
'clim',[-1,1])
To ['color', 'w']:
set(gca, 'Xlim',xlims,'Ylim',ylims, 'color', 'w','XColor','none','YColor','none',...
'clim',[-1,1])

serafeim loukas

serafeim loukas (view profile)

Amazing toolbox. thank you.

Can someone explain me that color correspond to what vector like [1 0 1] ?

Oleg Komarov

Oleg Komarov (view profile)

I am currently working on a bright theme (to address @Julia and other's request) and on allowing fully formed custom colormaps. This requires a bit of rework in the parameter parsing and on colour control.

Oleg Komarov

Oleg Komarov (view profile)

@Julia: you can set(gca,'Color','white') but be aware that the way the colormap is set, average values will be dark/black, so you will have a central mass of dark lines. To see what I mean, check the default colormap here http://stackoverflow.com/a/17111675/2180721
To achieve white background you will need to change the colormap such that the two extremes blend in the middle into white.

Julia Ballester

Julia Ballester (view profile)

Really useful and easy to manage! I have a question... Is it possible to change the background of the graph to white? I tried it and I can just change the background of the figure. Any advice will help, thanks!

Julia Ballester

Oleg Komarov

Oleg Komarov (view profile)

@cmo I cannot reproduce the issue. Can you provide an example?

@Anca Mitrea You need to save it with optional arguments for higher resolution. Please, see the matlab docs for print() and/or saveas(). You can also try export_fig http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig

Anca Mitrea

Anca Mitrea (view profile)

Awesome tool, love it! I have a question... I would like to print the result on an A0 or A1 paper size and if I simply save it as it is, when I zoom it, it gets pixeled. What should I do? Thank you very much!

cmo

cmo (view profile)

works great!
when I use "saveas", the resulting PNG has a white background.
How do I print it to file with the black background?

Nebitno

Thanks Oleg!

Oleg Komarov

Nebitno

Nebitno (view profile)

Silly question: how do I reference a figure that I generated using your code?

Nebitno

Oleg Komarov

Oleg Komarov (view profile)

@Pascal
You can normalize your matrix. I left this aspect to the user, since she can choose how to re-map the matrix to an arbitrary interval.

Pascal Schulthess

Pascal Schulthess (view profile)

Absolutely fantastic.
But, I'd love a way to also input arbitrary matrices with arbitrary value ranges. Is there a way to do that?

amanita

Wilma

jun

fantastic!!!

karlo gonzales