SOM Toolbox | Online documentation | http://www.cis.hut.fi/projects/somtoolbox/ |
color=som_clustercolor(m, class, colorcode)
SOM_CLUSTERCOLOR Sets map unit coloring according to classification syntax 1: color = som_clustercolor(m, class, [colorcode]) syntax 2: color = som_clustercolor(class, colormatrix) Input and output arguments ([]'s are optional): m (struct) map or topol struct (cell array) of form {str,[m1 m2]} where str = 'hexa' or 'rect' and [m1 m2] = msize. class (matrix) Mxn matrix of integers (class labels) where M is the number of map units and each column gives some classification for the units. colorcode (string) 'rgb1', 'rgb2' (default), 'rgb3', 'rgb4', 'hsv'. colormatrix (matrix) Mx3 matrix of RGB triplets giving the initial color code for each unit. color (matrix) size Mx3xn of RGB triplets giving the resulting color code for each unit The function gives a color coding by class and location for the map units. The color is determined by calculating the mean of the initial RGB values of units belonging to the same class. Function has two syntaxes: * If first argument gives the map topology, i.e. is map or topol struct or cell indicating the topology, the initial color coding of the units may be given by a string ('rgb1','rgb2','rgb3','rgb4', or 'hsv') which describe a predefined coloring scheme. (see SOM_COLORCODE). or an initial color matrix of size Mx3 with RGB triplets as rows. * Another possibility is to give just the classification vector of size Mx1 and an initial color matrix of size Mx3 with RGB triplets as rows. EXAMPLE (requires Matlab Statistics Toolbox) % Do a 10-cluster single linkage hierachical clustering for SOM units class=cluster(linkage(pdist(sM.codebook),'single'),10); % Color code the clusters C=som_clustercolor(sM, class, 'rgb2'); % Visualize som_show(sM,'color',C); See also SOM_COLORCODE, SOM_KMEANSCOLOR, SOM_CPLANE, SOM_SHOW