lucas_0511
lucas_0511

Reputation: 11

Is it possible to create a heatmap within a SOM-Cluster with the values of a dimension, which is not included in the cluster itself in R?

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!

Upvotes: 1

Views: 141

Answers (1)

Urb
Urb

Reputation: 115

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)

Upvotes: 0

Related Questions