Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to visualize correlation matrix as a schemaball in Matlab

I have 42 variables and I have calculated the correlation matrix for them in Matlab. Now I would like to visualize it with a schemaball. Does anyone have any suggestions / experiences how this could be done in Matlab? The following pictures will explain my point better:

SCHEMABALL

enter image description here

In the pictures each parabola between variables would mean the strength of correlation between them. The thicker the line is, the more correlation. I prefer the style of picture 1 more than the style in picture 2 where I have used different colors to highlight the strength of correlation.

like image 876
jjepsuomi Avatar asked Jun 11 '13 07:06

jjepsuomi


People also ask

How do you plot a correlation matrix in Matlab?

To select a subset of variables in Tbl , for which to plot the correlation matrix, use the DataVariables name-value argument. [___] = corrplot(___, Name=Value ) uses additional options specified by one or more name-value arguments, using any input-argument combination in the previous syntaxes.

How do you make a Correlogram in Matlab?

R = corrcoef( A ) returns the matrix of correlation coefficients for A , where the columns of A represent random variables and the rows represent observations. R = corrcoef( A , B ) returns coefficients between two random variables A and B .

How do you visualize a large correlation matrix?

You can use qgraph to visualize a correlation matrix as a network. This will plot variables as nodes and correlations as edges connecting the nodes. Green edges indicate positive correlations and red edges indicate negative correlations. The wider and more saturated the edges the stronger the absolute correlation.


1 Answers

Kinda finished I guess.. code can be found here at github. Documentation is included in the file.

The yellow/magenta color (for positive/negative correlation) is configurable, as well as the fontsize of the labels and the angles at which the labels are plotted, so you can get fancy if you want and not distribute them evenly along the perimeter/group some/...

If you want to actually print these graphs or use them outside matlab, I suggest using vector formats (eg eps). It's also annoying that the text resizes when you zoom in/out, but I don't know of any way to fix that without hacking the zoom function :/

schemaball % demo 

enter image description here

schemaball(arrayfun(@num2str,1:10,'uni',false), rand(10).^8,11,[0.1587 0.8750],[0.8333 1],2*pi*sin(linspace(0,pi/2-pi/20,10))) 

enter image description here

schemaball(arrayfun(@num2str,1:50,'uni',false), rand(50).^50,9) 

enter image description here

like image 174
Gunther Struyf Avatar answered Sep 17 '22 13:09

Gunther Struyf