plot.som: Plot cell contents of a Self-Organising Map

Description Usage Arguments Details Author(s) References See Also Examples

Description

Plot a glyph based rendering of data associated to each cell of the prior structure of a Self-Organising Map. Each glyph is positioned thanks to the prior structure.

Usage

1
2
3
4
## S3 method for class 'som'
plot(x, y, mode=c("prototype","data"),
type=c("parallel","stars","barplot"), 
with.grid=FALSE, barplot.align=c("bottom","center"), global.scale=FALSE, ...)

Arguments

x

an object of class "som"

y

a matrix or a data frame of data associated to the som's prototypes

mode

the mode of the display, either "prototype" for a single glyph per grid cell or "data" for multiple glyphs (see details)

type

the type of the plot, chosen from "parallel", "stars" and "barplot" (see details)

with.grid

logical, with default to FALSE. If TRUE, the prior grid is drawn underneath the rest of the display

barplot.align

specifies the alignment used for the barplots when type="barplot"

global.scale

logical, with default to FALSE. If TRUE, the prototypes coordinates are scaled globally, while a per dimension scaling is used when global.scale=TRUE

...

additional parameters transmitted to the low level plot function (see details)

Details

This function uses the prior structure of a fitted SOM to arrange some glyphs on a screen, either a single glyph per cell (when mode="prototype") or an arbitrary number of glyphs per cell, including zero (when mode="data"). The primary usage of this function is to display either to the prototypes of a fitted SOM or to display the data points associated to each cluster.

The glyph calculation depends on the mode parameter as follows:

mode="prototype"

In this case, one glyph is computed per cell in the prior structure. When y is missing, the glyph corresponds to the prototype associated to the corresponding cluster. In this situation, the function is restricted to numerical SOMs (as obtained with batchsom.default). When y is specified, it must be a matrix or a data.frame with numerical content. Each row of y is used to compute a glyph.

mode="data"

In this case, an arbitrary number of glyphs is associated to each cell. When y is missing, a glyph is computed for each original data point assigned to the corresponding cluster/cell. As in the previous case, the function is restricted to numerical SOMs. When y is specified, it must be a list with length equal to the number of cells in the prior structure (for instance, the result of mapToUnit). The list must be homogeneous and is restricted to two types of content. The first type corresponds to matrix/data.frame: all matrices/data.frames must have the same number of columns and each row defines a glyph. The second type corresponds to factors: each cell of y must be a factor defined on an unique and common set of levels.

The actual glyphs depend on the type parameter:

type="parallel"

this corresponds to a parallel coordinate like representation: each prototype is considered as a function mapping its coordinate index to the associated value. Functions are displayed as lines.

type="stars"

in this case, the function uses stars to draw a star plot for each prototype, at the corresponding position in the prior structure

type="barplot"

this representation uses a barplot for each prototype. When barplot.align="bottom" (the default value), the prototypes coordinates are scaled to [0,1] while they are scaled to [-1,1] when barplot.align="center". In both cases, the baseline line of the barplots is at 0 which gives two different types of visualisation. In the case of mode="data", bar plots are restricted to the factor valued case for y.

Additional parameters can be transmitted to the underlying low level drawing functions. Parameters prefixed by grid. are used for the grid plotting when with.grid=TRUE (see plot.somgrid).

Author(s)

Fabrice Rossi

References

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.

See Also

See mapToUnit for building y when mode="data"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(iris)
# scaling
data <- scale(iris[1:4])

# a small hexagonal grid
sg <- somgrid(xdim=7,ydim=7,topo="hex")

# fit the SOM
som <- batchsom(data,sg)

# and display the prototypes as parallel coordinates
plot(som)

# display the prototypes as star plots, with a red grid
plot(som,type="stars",with.grid=TRUE,grid.border="red")

# display all the data as parallel coordinates
plot(som,mode="data",with.grid=TRUE)

# display an additional factor variable with a barplot
plot(som,mapToUnit(som,iris[[5]]),mode="data",type="barplot")

yasomi documentation built on May 2, 2019, 5:59 p.m.