Plotting Eight Direction Arranged Maps or Self-Organizing Maps
shardsplot(object, plot.type = c("eight", "four", "points", "n"), expand = 1, stck = TRUE, grd = FALSE, standardize = FALSE, data.or = NA, label = FALSE, plot = TRUE, classes = 0, vertices = TRUE, classcolors = "rainbow", wghts = 0, xlab = "Dimension 1", ylab = "Dimension 2", xaxs = "i", yaxs = "i", plot.data.column = NA, log.classes = FALSE, revert.colors = FALSE, ...) level_shardsplot(object, par.names, rows = 1:NCOL(object$data), centers = rep(NA, length(par.names)), class.labels = NA, revert.colors = rep(FALSE, length(par.names)), log.classes = rep(FALSE, length(par.names)), centeredcolors = colorRamp(c("red", "white", "blue")), mfrow = c(2, 2), plot.type = c("eight", "four", "points", "n"), expand = 1, stck = TRUE, grd = FALSE, standardize = FALSE, label = FALSE, plot = TRUE, vertices = TRUE, classcolors = "topo", wghts = 0, xlab = "Dimension 1", ylab = "Dimension 2", xaxs = "i", yaxs = "i", ...) ## S3 method for class 'EDAM' plot(...)
object |
an object of class |
par.names |
names used to lable the data columns |
rows |
vector with indices of colomns to be plotted |
centers |
vector of type numeric defining the class centers for the data. NA if data does not have a center. |
class.labels |
matrix of type text and |
centeredcolors |
colors to represent the classes with a central value |
mfrow |
parameter defining number of plots on a page. see |
plot.type |
a character giving the shape of the shards.
Available are “ |
expand |
a numeric giving the relative expansion of the axes.
A value greater than one implies smaller shards. Varying |
stck |
logical. If |
grd |
logical. If |
standardize |
logical. If |
data.or |
original data and classes where the first k columns are variables and the (k+1)-th column are the classes.
If defined and class of |
label |
logical. If |
plot |
logical. If |
classes |
a vector giving alternative classes for objects of class |
vertices |
logical. If |
classcolors |
colors to represent the classes, or a character giving the colorscale for the classes.
Since now available scales are |
wghts |
an optional vector of length k giving relative weights of the variables
in computing Euclidean distances. Meaningless if |
xaxs |
see |
yaxs |
see |
xlab |
see |
ylab |
see |
... |
further plotting parameters. |
plot.data.column |
column index defining from |
log.classes |
boolean indicating that the data should be transformed with the logarithmic function before calculating the cell coloring |
revert.colors |
boolean indicating that the colorscale should be reverted. |
level_shardsplot
uses multiple shardsplot
representations of a SOM in order to depict how
the data used to calculate the SOM is distribution across the map.
Two representations are possible for the data, first with a single color ramp from the minimum
value to the maximum value. The second representation is usefull for data for which a basic
value exists some where between minimum and maximum for which a special color representation should be used
(e.g. 0 is indicated with white).
If plot.type
is “four
” or “eight
”, the shape of each shard depends
on the relative distances of the actual object
or codebook to its up to eight neighbours. If plot.type
is “eight
”, shardsplot
corresponds to the representation method
suggested by Cottrell and de Bodt (1996) for Kohonen Self-Organizing Maps.
If plot.type
is “points
”, shardsplot
reduces to a usual scatter plot.
The following list is (invisibly) returned:
Cells.ex |
the images of the visualized data |
S |
the criterion of the visualization |
Nils Raabe, level_shardsplot
function from Dominik Reusser
Cottrell, M., and de Bodt, E. (1996). A Kohonen Map Representation to Avoid Misleading Interpretations. Proceedings of the European Symposium on Atrificial Neural Networks, D-Facto, pp. 103–110.
# Compute clusters and an Eight Directions Arranged Map for the # country data. Plotting the result. data(countries) logcount <- log(countries[,2:7]) sdlogcount <- apply(logcount, 2, sd) logstand <- t((t(logcount) / sdlogcount) * c(1,2,6,5,5,3)) cclasses <- cutree(hclust(dist(logstand)), k = 6) countryEDAM <- EDAM(logstand, classes = cclasses, sa = FALSE, iter.max = 10, random = FALSE) plot(countryEDAM, vertices = FALSE, label = TRUE, stck = FALSE) # Compute and plot a Self-Organizing Map for the iris data data(iris) library(som) irissom <- som(iris[,1:4], xdim = 6, ydim = 14) shardsplot(irissom, data.or = iris, vertices = FALSE) opar <- par(xpd = NA) legend(7.5, 6.1, col = rainbow(3), xjust = 0.5, yjust = 0, legend = levels(iris[, 5]), pch = 16, horiz = TRUE) par(opar) level_shardsplot(irissom, par.names = names(iris), class.labels = NA, mfrow = c(2,2))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.