[R] Help with plotting kohonen maps
Stella Pachidi
stella.pachidi at gmail.com
Mon Nov 22 15:32:51 CET 2010
Dear all,
I recently started using the kohonen package for my thesis project. I
have a very simple question which I cannot figure out by myself:
When I execute the following example code, from the paper of Wehrens
and Buydens (http://www.jstatsoft.org/v21/i05/paper):
R> library("kohonen")
Loading required package: class
R> data("wines")
R> wines.sc <- scale(wines)
R> set.seed(7)
R> wine.som <- som(data = wines.sc, grid = somgrid(5, 4, "hexagonal"))
R> plot(wine.som, main = "Wine data")
I get to have a plot of the codebook vectors of the 5-by-4 mapping of
the wine data, and it also includes which variable names correspond
to each color. (same picture as in the paper)
However, when I run the som() function with my own data and I try to
get the plot afterwards:
library("kohonen")
self_Organising_Map <- som(data = tableToCluster, grid = somgrid(5, 2,
"rectangular"), rlen=1000)
plot(self_Organising_Map, main = "Kohonen Map of Clustered Profiles")
the resulting plot does not contain the color labels i.e. the
variable names of my data table, even though they exist and are
included as column names of tableToCluster.
I also tried the following line:
plot(self_Organising_Map, type="codes", codeRendering = "segments",
ncolors=length(colnames(self_Organising_Map$codes)),
palette.name=rainbow, main = "Kohonen Map of Clustered Profiles \n
Codes", zlim =colnames(self_Organising_Map$codes))
but it had the same result.
If you could please help with what argument I should use to show the
color labels in the codes plot of the kohonen map, please drop a line!
Kind regards,
Stella
--
Stella Pachidi
Master in Business Informatics student
Utrecht University
More information about the R-help
mailing list