Description Usage Arguments Details Author(s) References Examples
Plot the prior structure used by a Self-Organizing Map. The rendering is glyph based. Rectangular grids use square glyphs while hexagonal grids use hexagons (the generic term is cell). Glyph positioning is fixed (according to the prior structure) but glyph size and color can be used to encode different type of results.
1 2 3 4 |
x |
an object of class |
col |
colors of the cells |
size |
sizes of the cells (must be between 0 and 1, inclusive) |
add |
logical. If |
border |
the color to draw the border. The default, |
colorValues |
a vector containing the values to be used for calculating the colors of the cells. If specified, this takes precedence over the |
sizeValues |
a vector containing the values to be used for calculating the size of the cells. If specified, this takes precedence over the |
colormap |
if an integer, gives the number of colors to be generated by |
withkey |
logical. If |
color.palette |
a color palette function to be used to assign
colors to the glyphs (defaults to |
... |
additional parameters transmitted to the low level plot function (i.e., |
When asked for a key, this function uses the layout
facilities. It is therefore incompatible with other device splitting functions (par
(mfrow), par(mfcol)
and split.screen
).
Fabrice Rossi
Vesanto, J. (2002) Data Exploration Process Based on the Self–Organizing Map, PhD thesis, Helsinki University of Technology, Espoo (Finland), Acta Polytechnica Scandinavica, Mathematics and Computing Series No. 115.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | data(iris)
# scaling
data <- scale(iris[1:4])
# a medium hexagonal grid
sg <- somgrid(xdim=15,ydim=15,topo="hex")
# empty grid
plot(sg)
# choose a good SOM
som <- som.tune(data,sg)$best.som
# color based on the first coordinate (sepal length), size on the second
# (sepal width) of the prototypes
plot(sg,colorValues=som$prototypes[,1],sizeValues=som$prototypes[,2],
withkey=TRUE)
# color based on the dominant class
col <- rep(NA,sg$size)
classes <- sapply(mapToUnit(som,iris[[5]]),summary)
col[colSums(classes)!=0] <-
c("red","blue","green")[apply(classes[,colSums(classes)!=0],2,which.max)]
plot(sg,col=col)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.