I am running :
kmeansDat.t <- som_model$codes[[1]] %>% as.matrix
som_cluster <- cutree(hclust(dist(kmeansDat.t)), 5) %>% as.matrix
# plot these results:
plot(som_model, type="mapping", bgcol = pretty_palette[som_cluster], main = "Clusters")
add.cluster.boundaries(som_model, som_cluster)
My output is cluttered by dark circles each appears to be representing the number of observations in each node. How can I remove them ?
Any idea why this is happening?
Setting pchs=""
inside plot.kohonen
solves the problem:
library(kohonen)
library(magrittr)
# A dataset for testing the code
data(yeast)
X <- matrix(rnorm(100000), nrow=1000)
som_model <- som(X, somgrid(30, 30, "hexagonal"))
kmeansDat.t <- som_model$codes[[1]] %>% as.matrix
pretty_palette <- rainbow(5)
som_cluster <- cutree(hclust(dist(kmeansDat.t)), 5) %>% as.matrix
# Plot Kohonen's map
plot(som_model, type="mapping", bgcol = pretty_palette[som_cluster],
main = "Clusters", pchs="")
add.cluster.boundaries(som_model, som_cluster)