\HeaderA{pltree.twins}{Clustering Tree of a Hierarchical Clustering}{pltree.twins}
\keyword{cluster}{pltree.twins}
\keyword{hplot}{pltree.twins}
\begin{Description}\relax
Draws a clustering tree (dendrogram) of a \code{twins} object, i.e.,
hierarchical clustering, typically resulting from
\code{\LinkA{agnes}{agnes}()} or \code{\LinkA{diana}{diana}()}.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'twins':
pltree(x, main = paste("Dendrogram of ", deparse(x$call)),
             labels = NULL, ylab = "Height", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object of class \code{"twins"}, typically created by either
\code{\LinkA{agnes}{agnes}()} or \code{\LinkA{diana}{diana}()}.
\item[\code{main}] main title with a sensible default.
\item[\code{labels}] labels to use; the default is constructed from \code{x}.
\item[\code{ylab}] label for y-axis.
\item[\code{...}] graphical parameters (see \code{\LinkA{par}{par}}) may also
be supplied as arguments to this function.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Creates a plot of a clustering tree given a \code{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
\code{plot(\LinkA{as.hclust}{as.hclust}(x), ...)}, which dispatches to
\code{\LinkA{plot.hclust}{plot.hclust}(..)}.  If more flexible plots are needed,
consider \code{xx <- \LinkA{as.dendrogram}{as.dendrogram}(\LinkA{as.dendrogram}{as.dendrogram}(x))} and plotting
\code{xx}, see \code{\LinkA{plot.dendrogram}{plot.dendrogram}}.
\end{Details}
\begin{Value}
a NULL value is returned.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{agnes}{agnes}}, \code{\LinkA{agnes.object}{agnes.object}}, \code{\LinkA{diana}{diana}},
\code{\LinkA{diana.object}{diana.object}}, \code{\LinkA{hclust}{hclust}}, \code{\LinkA{par}{par}},
\code{\LinkA{plot.agnes}{plot.agnes}}, \code{\LinkA{plot.diana}{plot.diana}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
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)
\end{ExampleCode}
\end{Examples}

