pltree.twins             package:cluster             R Documentation

_C_l_u_s_t_e_r_i_n_g _T_r_e_e _o_f _a _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:

     Draws a clustering tree (dendrogram) of a 'twins' object, i.e.,
     hierarchical clustering, typically resulting from 'agnes()' or
     'diana()'.

_U_s_a_g_e:

     ## S3 method for class 'twins':
     pltree(x, main = paste("Dendrogram of ", deparse(x$call)),
                  labels = NULL, ylab = "Height", ...)

_A_r_g_u_m_e_n_t_s:

       x: an object of class '"twins"', typically created by either
          'agnes()' or 'diana()'.

    main: main title with a sensible default.

  labels: labels to use; the default is constructed from 'x'.

    ylab: label for y-axis.

     ...: graphical parameters (see 'par') may also be supplied as
          arguments to this function.

_D_e_t_a_i_l_s:

     Creates a plot of a clustering tree given a 'twins' object.  The
     leaves of the tree are the original observations.  In case of an
     agglomerative clustering, two branches come together at the
     distance between the two clusters being merged.  For a divisive
     clustering, a branch splits up at the diameter of the cluster
     being splitted.

     Note that currently the method function simply calls
     'plot(as.hclust(x), ...)', which dispatches to 'plot.hclust(..)'. 
     If more flexible plots are needed, consider 'xx <-
     as.dendrogram(as.hclust(x))' and plotting 'xx', see
     'plot.dendrogram'.

_V_a_l_u_e:

     a NULL value is returned.

_S_e_e _A_l_s_o:

     'agnes', 'agnes.object', 'diana', 'diana.object', 'hclust', 'par',
     'plot.agnes', 'plot.diana'.

_E_x_a_m_p_l_e_s:

     data(votes.repub)
     agn <- agnes(votes.repub)
     pltree(agn)

     dagn  <- as.dendrogram(as.hclust(agn))
     dagn2 <- as.dendrogram(as.hclust(agn), hang = 0.2)
     op <- par(mar = par("mar") + c(0,0,0, 2)) # more space to the right
     plot(dagn2, horiz = TRUE)
     plot(dagn, horiz = TRUE, center = TRUE,
          nodePar = list(lab.cex = 0.6, lab.col = "forest green", pch = NA),
          main = deparse(agn$call))
     par(op)

