# NOT RUN {
mygrid <- somgrid(5, 5, "hexagonal")
fakesom <- list(grid = mygrid)
class(fakesom) <- "kohonen"
par(mfrow = c(2,1))
dists <- unit.distances(mygrid)
plot(fakesom, type="property", property = dists[1,],
main="Distances to unit 1", zlim=c(0,6),
palette = rainbow, ncolors = 7)
dists <- unit.distances(mygrid, toroidal=TRUE)
plot(fakesom, type="property", property = dists[1,],
main="Distances to unit 1 (toroidal)", zlim=c(0,6),
palette = rainbow, ncolors = 7)
# }
Run the code above in your browser using DataLab