aweSOMsmoothdist | R Documentation |
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.
aweSOMsmoothdist( som, pal = c("viridis", "grey", "rainbow", "heat", "terrain", "topo", "cm", rownames(RColorBrewer::brewer.pal.info)), reversePal = FALSE, legendFontsize = 14 )
som |
|
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. |
Returns an object of classes gg
and ggplot
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.