plot.agnes package:cluster R Documentation _P_l_o_t_s _o_f _a_n _A_g_g_l_o_m_e_r_a_t_i_v_e _H_i_e_r_a_r_c_h_i_c_a_l _C_l_u_s_t_e_r_i_n_g _D_e_s_c_r_i_p_t_i_o_n: Creates plots for visualizing an 'agnes' object. _U_s_a_g_e: ## 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, ...) _A_r_g_u_m_e_n_t_s: x: an object of class '"agnes"', typically created by 'agnes(.)'. ask: logical; if true and 'which.plots' is 'NULL', 'plot.agnes' 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 _banner_ plot or '2' for a dendrogram or ``clustering tree''. main, sub: main and sub title for the plot, with convenient defaults. See documentation for these arguments in 'plot.default'. adj: for label adjustment in 'bannerplot()'. nmax.lab: integer indicating the number of labels which is considered too large for single-name labelling the banner plot. max.strlen: positive integer giving the length to which strings are truncated in banner plot labeling. xax.pretty: logical or integer indicating if 'pretty(*, n = xax.pretty)' should be used for the x axis. 'xax.pretty = FALSE' is for back compatibility. ...: graphical parameters (see 'par') may also be supplied and are passed to 'bannerplot()' or 'pltree()' (see 'pltree.twins'), respectively. _D_e_t_a_i_l_s: When 'ask = 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()', i.e., its method 'pltree.twins', respectively. directly with corresponding arguments, e.g., 'xlab' or 'ylab'. _S_i_d_e _E_f_f_e_c_t_s: Appropriate plots are produced on the current graphics device. This can be one or both of the following choices: Banner Clustering tree _N_o_t_e: In the banner plot, observation labels are only printed when the number of observations is limited less than 'nmax.lab' (35, by default), for readability. Moreover, observation labels are truncated to maximally 'max.strlen' (5) characters. For the dendrogram, more flexibility than via 'pltree()' is provided by 'dg <- as.dendrogram(x)' and plotting 'dg' via 'plot.dendrogram'. _R_e_f_e_r_e_n_c_e_s: Kaufman, L. and Rousseeuw, P.J. (1990) _Finding Groups in Data: An Introduction to Cluster Analysis_. Wiley, New York. 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. _S_e_e _A_l_s_o: 'agnes' and 'agnes.object'; 'bannerplot', 'pltree.twins', and 'par'. _E_x_a_m_p_l_e_s: ## 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