shardsplot               package:klaR               R Documentation

_P_l_o_t_t_i_n_g _E_i_g_h_t _D_i_r_e_c_t_i_o_n _A_r_r_a_n_g_e_d _M_a_p_s _o_r _S_e_l_f-_O_r_g_a_n_i_z_i_n_g _M_a_p_s

_D_e_s_c_r_i_p_t_i_o_n:

     Plotting method for objects of 'class' 'EDAM' or 'som'.

_U_s_a_g_e:

     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", ...)

     ## S3 method for class 'EDAM':
     plot(...)

_A_r_g_u_m_e_n_t_s:

  object: an object of class 'EDAM' or 'som'.

plot.type: a character giving the shape of the shards.  Available are
          "'eight'" and "'four'" for octagons resp. rectangles,  and
          "'points'" for points. If 'plot.type' is "'n'",  no shards
          are plotted at all.

  expand: a numeric giving the relative expansion of the axes.  A value
          greater than one implies smaller shards. Varying 'expand' can
          be sensible for visual reasons.

    stck: logical. If 'TRUE' the cells are varied continously
          corresponding to  the differences of direct neighbors in the
          origin space.  Within this variation the relative order of
          the cells is always preserved.

     grd: logical. If 'TRUE' (which automatically sets 'stck' to
          'TRUE'),  the variation of cells is restricted to their
          original discrete values.

standardize: logical. If 'TRUE', then the measurements in
          'object$preimages'  are standardized before calculating
          Euclidean distances.  Measurements are standardized for each
          variable by dividing by the variable's  standard deviation.
          Meaningless if 'object$preimages' is a dissimilarity matrix. 

 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 'object' is 'som', 'data.or' is used to assign a
          class to each codebook. There a codebook receives the class,
          from which the majority of its assigned objects origins.

   label: logical. If 'TRUE', the shards are labeled by the rownames of
          the preimages.

    plot: logical. If 'FALSE', all graphical output is suppressed.

 classes: a vector giving alternative classes for objects of class
          'EDAM'; 'classes' have to be given in  the original order of
          the data to which 'EDAM' was applied.

vertices: logical. If 'TRUE' the grid is drawn.

classcolors: colors to represent the classes, or a character giving the
          _colorscale_ for the classes.  Since now available scales are
          'rainbow', 'topo' and 'gray'.

   wghts: an optional vector of length k giving relative weights of the
          variables  in computing Euclidean distances. Meaningless if
          'object$preimages' is a dissimilarity matrix.

    xaxs: see 'par'

    yaxs: see 'par'

    xlab: see 'par'

    ylab: see 'par'

     ...: further plotting parameters.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     The following list is (invisibly) returned: 

Cells.ex: the images of the visualized data

       S: the criterion of the visualization

_A_u_t_h_o_r(_s):

     Nils Raabe

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     'EDAM', 'TopoS', 'som'

_E_x_a_m_p_l_e_s:

     # 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)    

