Search code examples
matlabplotneural-networkmatlab-figuresom

Change dimensions of plot MATLAB


I'm trying to visualize SOM neural network. There is a plotsom function for this. It works but it stretches the plot through one dimension:

original plot: enter image description here

and different views (X-Y ; X-Z and Y-Z): enter image description here

I don't understand how to make it's axis fairly evenly disturbed. My code: (originally A == net.IW{1,1} and B = net.layers{1}.distances)

A =  

1.0e+04 *

0.1659    0.0736    1.7223
0.1460    0.0772    1.2072
0.1207    0.0747    1.4661
0.1007    0.0783    0.9510
0.1439    0.0895    1.4653
0.1239    0.0930    0.9502
0.0987    0.0905    1.2091
0.0787    0.0941    0.6941

B = 

 0     1     1     2     1     2     2     3
 1     0     1     1     1     1     2     2
 1     1     0     1     1     2     1     2
 2     1     1     0     2     1     1     1
 1     1     1     2     0     1     1     2
 2     1     2     1     1     0     1     1
 2     2     1     1     1     1     0     1
 3     2     2     1     2     1     1     0


plotsom(A,B)

Solution

  • The plot is using axis equal to ensure that the scaling on each axis is the same. If you want to disable this, you can call axis normal after plotting which will changes the scaling of each axis to best fit the data.

    plotsom(A,B);
    axis normal
    

    enter image description here