| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/rotate.R |
| 3 |
\name{ladderize} |
| 4 |
\alias{ladderize} |
| 5 |
\alias{ladderize.dendrogram} |
| 6 |
\alias{ladderize.phylo} |
| 7 |
\alias{ladderize.dendlist} |
| 8 |
\title{Ladderize a Tree} |
| 9 |
\usage{ |
| 10 |
ladderize(x, right = TRUE, ...) |
| 11 |
|
| 12 |
\method{ladderize}{dendrogram}(x, right = TRUE, ...) |
| 13 |
|
| 14 |
\method{ladderize}{phylo}(x, right = TRUE, phy, ...) |
| 15 |
|
| 16 |
\method{ladderize}{dendlist}(x, right = TRUE, which, ...) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{x}{a tree object (either a \link{dendrogram}, \link{dendlist}, or \link[ape]{phylo})} |
| 20 |
|
| 21 |
\item{right}{a logical (TRUE) specifying whether the smallest clade is on the right-hand side (when the tree is plotted upwards), or the opposite (if FALSE).} |
| 22 |
|
| 23 |
\item{...}{Currently ignored.} |
| 24 |
|
| 25 |
\item{phy}{a placeholder in case the user uses "phy ="} |
| 26 |
|
| 27 |
\item{which}{an integer (can have any number of elements). |
| 28 |
It indicates the elements in the \link{dendlist} to ladderize. |
| 29 |
If missing, it will ladderize all the dendrograms in the dendlist.} |
| 30 |
} |
| 31 |
\value{ |
| 32 |
A rotated tree object |
| 33 |
} |
| 34 |
\description{ |
| 35 |
This function reorganizes the internal structure of the tree to get the ladderized effect when plotted. |
| 36 |
} |
| 37 |
\examples{ |
| 38 |
|
| 39 |
dend <- USArrests[1:8, ] \%>\% |
| 40 |
dist() \%>\% |
| 41 |
hclust() \%>\% |
| 42 |
as.dendrogram() \%>\% |
| 43 |
set("labels_colors") \%>\% |
| 44 |
set("branches_k_color", k = 5) |
| 45 |
set.seed(123) |
| 46 |
dend <- shuffle(dend) |
| 47 |
|
| 48 |
par(mfrow = c(1, 3)) |
| 49 |
dend \%>\% plot(main = "Original") |
| 50 |
dend \%>\% |
| 51 |
ladderize(TRUE) \%>\% |
| 52 |
plot(main = "Right (default)") |
| 53 |
dend \%>\% |
| 54 |
ladderize(FALSE) \%>\% |
| 55 |
plot(main = "Left (rev of right)") |
| 56 |
} |
| 57 |
\seealso{ |
| 58 |
\code{\link[ape]{ladderize}}, \code{\link{rev.dendrogram}}, \code{\link[dendextend]{rotate}}, \code{\link[ape]{rotate}} |
| 59 |
} |