1

I have created a clustering with the help of the kohonen package in R. The cluster is defined by 6 different attributes, and results in a 15x15 matrix = 225 different clusters.

Now I want to create some kind of legend, to fill every cluster visualisation with a different color depending on a certain value (like a heatmap). The problem is, that this certain value is not part of the 6 attributes, which define the clusters. Because of this I cannot work with the standard heatmap-feature within the SOM-Package, because it only supports a heatmap of values that took part in the calculations.

Is there any way to include those values from outside the cluster-calculation into the heatmap?

Thank you very much!

lucas_0511
  • 11
  • 1
  • Please, try to follow these [suggestions](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to improve your question. – Stefano Barbi Feb 11 '22 at 16:28
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 18 '22 at 19:51

1 Answers1

0

Use the aweSOMplot() function in the aweSOM package. Even if the SOM was trained with a subset of the variables in the dataset, aweSOMplot() lets you pass the full dataframe (with more columns than the training dataframe) and select the variable to plot as color.

#Use the variable full.data$var to color the SOM
aweSOMplot(som = som, 
           type = "Color", 
           data = full.data, 
           variables = "var",
           showSC = FALSE)
Urb
  • 115
  • 6