plot.partition            package:cluster            R Documentation

_P_l_o_t _o_f _a _P_a_r_t_i_t_i_o_n _o_f _t_h_e _D_a_t_a _S_e_t

_D_e_s_c_r_i_p_t_i_o_n:

     Creates plots for visualizing a 'partition' object.

_U_s_a_g_e:

     ## S3 method for class 'partition':
     plot(x, ask = FALSE, which.plots = NULL,
                    nmax.lab = 40, max.strlen = 5, data = x$data, dist = NULL,
                    cor = TRUE, stand = FALSE, lines = 2,
                    shade = FALSE, color = FALSE, labels = 0, plotchar = TRUE,
                    span = TRUE, xlim = NULL, ylim = NULL, main = NULL, ...)

_A_r_g_u_m_e_n_t_s:

       x: an object of class '"partition"', typically created by the
          functions 'pam', 'clara', or 'fanny'.

     ask: logical; if true and 'which.plots' is 'NULL',
          'plot.partition' operates in interactive mode, via 'menu'.

which.plots: integer vector or NULL (default), the latter producing
          both plots.  Otherwise, 'which.plots' must contain integers
          of '1' for a _clusplot_ or '2' for _silhouette_.

nmax.lab: integer indicating the number of labels which is considered
          too large for single-name labeling the silhouette plot.

max.strlen: positive integer giving the length to which strings are
          truncated in silhouette plot labeling.

    data: numeric matrix with the scaled data; per default taken from
          the partition object 'x', but can be specified explicitly.

    dist: when 'x' does not have a 'diss' component as for 'pam(*,
          keep.diss=FALSE)', 'dist' must be the dissimilarity if a
          clusplot is desired.

cor,stand,lines,shade,color,labels,plotchar,span,xlim,ylim,main, ...: A
          ll optional arguments available for the 'clusplot.default'
          function (except for the 'diss' one) and graphical parameters
          (see 'par') may also be supplied as arguments to this
          function.

_D_e_t_a_i_l_s:

     When 'ask= TRUE', rather than producing each plot sequentially,
     'plot.partition' displays a menu listing all the plots that can be
     produced. If the menu is not desired but a pause between plots is
     still wanted, call 'par(ask= TRUE)' before invoking the plot
     command.

     The _clusplot_ of a cluster partition consists of a
     two-dimensional representation of the observations, in which the
     clusters are indicated by ellipses (see 'clusplot.partition' for
     more details).

     The _silhouette plot_ of a nonhierarchical clustering is fully
     described in Rousseeuw (1987) and in chapter 2 of Kaufman and
     Rousseeuw (1990). For each observation i, a bar is drawn,
     representing its silhouette width s(i), see 'silhouette' for
     details. Observations are grouped per cluster, starting with
     cluster 1 at the top.  Observations with a large s(i) (almost 1)
     are very well clustered, a small s(i) (around 0) means that the
     observation lies between two clusters, and observations with a
     negative s(i) are probably placed in the wrong cluster.

     A clustering can be performed for several values of 'k' (the
     number of clusters).  Finally, choose the value of 'k' with the
     largest overall average silhouette width.

_S_i_d_e _E_f_f_e_c_t_s:

     An appropriate plot is produced on the current graphics device. 
     This can be one or both of the following choices: 
      Clusplot 
      Silhouette plot

_N_o_t_e:

     In the silhouette plot, observation labels are only printed when
     the number of observations is less than 'nmax.lab' (40, by
     default), for readability.  Moreover, observation labels are
     truncated to maximally 'max.strlen' (5) characters.  
      For more flexibility, use 'plot(silhouette(x), ...)', see
     'plot.silhouette'.

_R_e_f_e_r_e_n_c_e_s:

     Rousseeuw, P.J. (1987) Silhouettes: A graphical aid to the
     interpretation and validation of cluster analysis. _J. Comput.
     Appl. Math._, *20*, 53-65.

     Further, the references in 'plot.agnes'.

_S_e_e _A_l_s_o:

     'partition.object', 'clusplot.partition', 'clusplot.default',
     'pam', 'pam.object', 'clara', 'clara.object', 'fanny',
     'fanny.object', 'par'.

_E_x_a_m_p_l_e_s:

     ## generate 25 objects, divided into 2 clusters.
     x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)),
                cbind(rnorm(15,5,0.5), rnorm(15,5,0.5)))
     plot(pam(x, 2))

     ## Save space not keeping data in clus.object, and still clusplot() it:
     data(xclara)
     cx <- clara(xclara, 3, keep.data = FALSE)
     cx$data # is NULL
     plot(cx, data = xclara)

