agnes
object.## S3 method for class 'agnes':
plot(x, ask = FALSE, which.plots = NULL, main = NULL,
sub = paste("Agglomerative Coefficient = ",round(x$ac, digits = 2)),
adj = 0, nmax.lab = 35, max.strlen = 5, xax.pretty = TRUE, ...)
"agnes"
, typically created by
agnes(.)
.which.plots
is NULL
,
plot.agnes
operates in interactive mode, via menu
.which.plots
must contain integers of 1
for a banner plot or 2
for a
dendrogramm or ``clustering tree''.plot.default
.bannerplot()
.pretty(*, n = xax.pretty)
should be used for the x axis.
xax.pretty = FALSE
is for back compatibility.par
) may also
be supplied and are passed to bannerplot()
or
pltree()
, respecask = TRUE
, rather than producing each plot sequentially,
plot.agnes
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
one must set par(ask= TRUE)
before invoking the plot command. The banner displays the hierarchy of clusters, and is equivalent to a tree.
See Rousseeuw (1986) or chapter 5 of Kaufman and Rousseeuw (1990).
The banner plots distances at which observations and clusters are merged.
The observations are listed in the order found by the agnes
algorithm,
and the numbers in the height
vector are represented as bars
between the observations.
The leaves of the clustering tree are the original observations. Two branches come together at the distance between the two clusters being merged.
For more customization of the plots, rather call
bannerplot
and pltree
directly with
corresponding arguments, e.g., xlab
or ylab
.
Rousseeuw, P.J. (1986). A visual display for hierarchical classification, in Data Analysis and Informatics 4; edited by E. Diday, Y. Escoufier, L. Lebart, J. Pages, Y. Schektman, and R. Tomassone. North-Holland, Amsterdam, 743--748.
Struyf, A., Hubert, M. and Rousseeuw, P.J. (1997) Integrating Robust Clustering Techniques in S-PLUS, Computational Statistics and Data Analysis, 26, 17-37.
agnes
and agnes.object
;
bannerplot
, pltree
, and par
.## Can also pass `labels' to pltree() and bannerplot():
data(iris)
cS <- as.character(Sp <- iris$Species)
cS[Sp == "setosa"] <- "S"
cS[Sp == "versicolor"] <- "V"
cS[Sp == "virginica"] <- "g"
ai <- agnes(iris[, 1:4])
plot(ai, labels = cS, nmax = 150)# bannerplot labels are mess
Run the code above in your browser using DataLab