library(kohonen)
data(wines)
kohmap <- som(wines, grid = somgrid(5, 5, "hexagonal"), rlen=10)
dists <- unit.distances(kohmap$grid, toroidal=FALSE)
plot(kohmap, type="property", property=dists[1,],
main="Distances to unit 1", zlim=c(0,6),
palette = rainbow, ncolors = 7, contin = TRUE)
dists <- unit.distances(kohmap$grid, toroidal=TRUE)
plot(kohmap, type="property", property=dists[1,],
main="Distances to unit 1 (toroidal)", zlim=c(0,6),
palette = rainbow, ncolors = 7, contin = TRUE)
kohmap <- som(wines, grid = somgrid(5, 5), rlen=10)
dists <- unit.distances(kohmap$grid, toroidal=FALSE)
plot(kohmap, type="property", property=dists[1,],
main="Distances to unit 1", zlim=c(0,4),
palette = rainbow, ncolors = 5, contin = TRUE)
dists <- unit.distances(kohmap$grid, toroidal=TRUE)
plot(kohmap, type="property", property=dists[1,],
main="Distances to unit 1 (toroidal)", zlim=c(0,4),
palette = rainbow, ncolors = 5, contin = TRUE)
Run the code above in your browser using DataLab