Creates plots for visualizing a
1 2 3 4 5 6
an object of class
logical; if true and
integer vector or NULL (default), the latter
producing both plots. Otherwise,
integer indicating the number of labels which is considered too large for single-name labeling the silhouette plot.
positive integer giving the length to which strings are truncated in silhouette plot labeling.
numeric matrix with the scaled data; per default taken
from the partition object
All optional arguments available for the
ask= TRUE, rather than producing each plot sequentially,
plot.partition displays a menu listing all the plots that can
If the menu is not desired but a pause between plots is still wanted,
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
The silhouette plot of a nonhierarchical clustering is fully
described in Rousseeuw (1987) and in chapter 2 of Kaufman and
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.
An appropriate plot is produced on the current graphics device. This
can be one or both of the following choices:
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
max.strlen (5) characters.
For more flexibility, use
plot(silhouette(x), ...), see
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
1 2 3 4 5 6 7 8 9 10
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.