I have used the Kohonen package in R to apply SOM to a genomics dataset I have. The SOM has 55 variables. I want to plot a subset of the codes for these variables as fanplots. For example, just using the wine dataset innate in R:
library(kohonen)
data(wines)
set.seed(7)
training <- sample(nrow(wines), 120)
Xtraining <- scale(wines[training, ])
Xtest <- scale(wines[-training, ],
center = attr(Xtraining, "scaled:center"),
scale = attr(Xtraining, "scaled:scale"))
som.wines <- som(Xtraining, grid = somgrid(5, 5, "hexagonal"))
plot(som.wines, type="codes")
This plots the weight of every predictor on each node as a fanplot. What I would like to do in this instance is plot say, just magnesium, ash, malic acid and flavonoids in the fanplot.
plot(som.wines, type = "property", property = som.wines$codes[,'magnesium'])
Will plot the weight for magnesium on each node.
Doing something like
plot(som.wines, type = "property", property =som.wines$codes[,c('magnesium','ash')])
Just overrides the magnesium weights with ash weights for each node.
Additionally something like:
plot(som.wines, type = "codes", property = som.wines$codes[,c('magnesium','ash')],)
Does not work either.
Any help would be very appreciated.