Formatting Self Organising Maps Plot

Hi All,

I've been using the package 'aweSOM' for plotting some pretty nice self organising maps visuals.

However, I wondered if someone could help me with some code to adjust the horizontal grid lines in the hexagons if possible?

In particular, aweSOM seems to have a default of five horizontal lines, and I would like to customise to three (or indeed none at all).

The following code allows visualisation, alongside the link at the bottom of the page. I've selected code to run the aweSOM barplot using Iris data:

library(aweSOM)
library(kohonen)
library(RColorBrewer)
library(cluster)

full.data <- iris

train.data <- full.data[, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")]

train.data <- scale(train.data)

set.seed(1465)
init <- somInit(train.data, 4, 4)

iris.som <- kohonen::som(train.data, grid = kohonen::somgrid(4, 4, "hexagonal"), 
                         rlen = 100, alpha = c(0.05, 0.01), radius = 
                         c(2.65,-2.65), 
                         dist.fcts = "sumofsquares", init = init)

superclust_pam <- cluster::pam(iris.som$codes[[1]], 3)
superclasses_pam <- superclust_pam$clustering

aweSOMplot(som = iris.som, type = "Barplot", data = full.data, 
           variables = c("Sepal.Length", "Sepal.Width",  
                         "Petal.Length", "Petal.Width"), 
           superclass = superclasses_pam, 
           values = "prototypes")

The package is here: aweSOM.

aweSOM/man/aweSOMplot.Rd at master · cran/aweSOM · GitHub.

Would appreciate the formatting help, if possible. Thanks

you can add "showAxes = FALSE" to the aweSOMplot - function which will remove the gridlines (and axes)
Everything else seems to be more complicated.

Thank you Matthias. Simple and effective solution. I appreciate it. Thank you :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.