aweSOMsmoothdist {aweSOM}R Documentation

Smooth Distance Plot for SOM

Description

Plots a visualization of the distances between the SOM cells. Based on the U-Matrix, which is computed for each cell as the mean distance to its immediate neighbors.

Usage

aweSOMsmoothdist(
  som,
  pal = c("viridis", "grey", "rainbow", "heat", "terrain", "topo", "cm",
    rownames(RColorBrewer::brewer.pal.info)),
  reversePal = FALSE,
  legendFontsize = 14
)

Arguments

som

kohonen object, a SOM created by the kohonen::som function.

pal

character, the color palette. Default is "viridis". Can be "viridis", "grey", "rainbow", "heat", "terrain", "topo", "cm", or any palette name of the RColorBrewer package.

reversePal

logical, whether color palette should be reversed. Default is FALSE.

legendFontsize

numeric, the font size for the legend. Default 14.

Value

Returns an object of classes gg and ggplot.

Examples

## Build training data
dat <- iris[, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")]
### Scale training data
dat <- scale(dat)
## Train SOM
### Initialization (PCA grid)
init <- somInit(dat, 4, 4)
ok.som <- kohonen::som(dat, grid = kohonen::somgrid(4, 4, 'rectangular'),
                       init = init)
aweSOMsmoothdist(ok.som)

[Package aweSOM version 1.2 Index]