plot.kohonen {kohonen} | R Documentation |
Plot self-organising map, obtained from function kohonen. Several types of plots are supported.
## S3 method for class 'kohonen': plot(x, type = c("codes", "changes", "counts", "dist.neighbours", "mapping", "property", "quality"), classif = NULL, labels = NULL, pchs = NULL, main = NULL, palette.name = heat.colors, ncolors, bgcol = NULL, zlim = NULL, heatkey = TRUE, property, contin, whatmap = NULL, codeRendering = NULL, keepMargins = FALSE, heatkeywidth = .2, ...)
x |
kohonen object. |
type |
type of plot. (Wow!) |
classif |
classification object, as returned by
predict.kohonen , or vector of unit numbers.
Only needed if type equals "mapping" and
"counts". |
labels |
labels to plot when type equals
"mapping". |
pchs |
symbols to plot when type equals
"mapping". |
main |
title of the plot. |
palette.name |
colors to use as unit background for "codes", "counts", "prediction", "property", and "quality" plotting types. |
ncolors |
number of colors to use for the unit backgrounds. Default is 20 for continuous data, and the number of distinct values (if less than 20) for categorical data. |
bgcol |
optional argument to colour the unit backgrounds for the "mapping" and "codes" plotting type. Defaults to "gray" and "transparent" in both types, respectively. |
zlim |
optional range for color coding of unit backgrounds. |
heatkey |
whether or not to generate a heatkey at the left side of the plot in the "property" and "counts" plotting types. |
property |
values to use with the "property" plotting type. |
contin |
whether or not the data should be seen as discrete (i.e. classes) or continuous in nature. Only relevant for the colour keys of plots of supervised networks. |
whatmap |
For supersom maps and a "codes" plot: what maps
to show. |
codeRendering |
How to show the codes. Possible choices: "segments", "stars" and "lines". |
keepMargins |
if FALSE (the default), restore the original
graphical parameters after plotting the kohonen map. If TRUE ,
one retains the map coordinate system so that one can add symbols to
the plot, or map unit numbers using the identify function. |
heatkeywidth |
width of the colour key; the default of 0.2 should work in most cases but in some cases, e.g. when plotting multiple figures, it may need to be adjusted. |
... |
other graphical parameters, e.g. colours of labels, or plotting symbols, in the "mapping" plotting type. |
Several different types of plots are supported:
property
contains the numerical
values. See examples below.Ron Wehrens
data(wines) set.seed(7) kohmap <- xyf(scale(wines), classvec2classmat(wine.classes), grid = somgrid(5, 5, "hexagonal"), rlen=100) plot(kohmap, type="changes") plot(kohmap, type="codes", main = c("Codes X", "Codes Y")) plot(kohmap, type="counts") plot(kohmap, type="quality") plot(kohmap, type="mapping", labels=wine.classes, col=wine.classes+1, main="mapping plot") xyfpredictions <- classmat2classvec(predict(kohmap)$unit.predictions) bgcols <- c("gray", "pink", "lightgreen") plot(kohmap, type="mapping", col=wine.classes+1, pchs=wine.classes, bgcol=bgcols[as.integer(xyfpredictions)], main="another mapping plot")