Function to plot hexagonal Kohonen maps

Share:

Description

The function plots hexagonal self-organising maps (SOMs), which have been created with Teuvo Kohonen's SOM_PAK software.

The plot shows an hexagonal lattice representing the codebook vectors of the SOM. Inside each hexagon a pie chart is drawn, showing the relative percentage of pattern classes, mapped to this codebook vector. The size of each pie chart is adjusted according to the number of mapped patterns.

Several arguments allow customisation of size, scale and colouring of the plot.

The function needs two files of the SOM_PAK file set:

  • The output of visual provides the mapping of input patterns to the codebook vectors.

  • The input file holding the mapped dataset with class information in the last column.

Usage

1
som.plot(visfile, datfile, ...)

Arguments

visfile

Name of the output file of visual. visual is the tool of SOM_PAK which maps pattern to the codebook vectors of a self-organising map.\ The function reads files in the format created by visual.

datfile

Name of the SOM_PAK input file. This files contains all input patterns and class information for each pattern. som-plot only uses the last colums of the file; i.e. the class information for each pattern.\ The function reads files in the format that is used by SOM_PAK.

...

Many other arguments can be given to control the appearence of the plot:

‘col’, default colours for the classes of the dataset. Possible values include:

‘default value: NA.’ Colours are generated by rainbow()

‘vector’ of colour definitions

‘data frame’ with name of a class in column 1 and colour definitions in column 2.

If the number of defined colours is smaller then the number of classes in the dataset, colours for the remaining classes are generated by rainbow.

‘onlyDefCols’ default: FALSE; if TRUE, all undefined colours are replaced by white

‘edit.cols’ default: FALSE; if TRUE, a dialog box opens and allows editing of all color definitions

‘show.legend’ default: TRUE; defines if colour legend is displayed

‘legend.width’ default: 4; Width of legend

‘turn’ default: FALSE; swap X and Y axis

‘window.width’ default: NA; width of the window

‘window.height’ default: NA; height of the window

‘show.box’ default: TRUE; show frame around the plot

‘show.axis’ default: FALSE; show x and Y axis

‘scaleX’ default: NA; scale factor for X axis (overwrites new.xdim argument)

‘scaleY’ default: NA; scale factor for Y axis (overwrites new.ydim argument)

‘scale’ default: NA; scale factor for X and Y axis (overwrites other scale argument)

‘new.xdim’ default: NA; scale X axis to specified number of neurons

‘new.ydim’ default: NA; scale Y axis to specified number of neurons

‘show.counter.border’ default: 0.98 percentile as limit for the display of labels in the pie charts

Value

The function does not returns a value.

Author(s)

Benjamin Schulz, Andreas Dominik

References

Schulz, B., Mauthe, T., Dominik, A., 2010. Visualisation of Kohonen Maps using R. THM University of Applied Sciences, Giessen, Germany Website, [Online]. Available at: http://www.life-science-it.org/pages/research/projectSomplot.html [Accessed 19 May 2011]. and http://www.bioconductor.org/packages/2.5/bioc/html/hexbin.html

Examples

1
2
som.plot(system.file("test.data/iris4som.out", package="somplot"), 
         system.file("test.data/iris4som.dat", package="somplot"))