| layout_tree_unrooted | R Documentation |
arranges the nodes of a tree (or forest) in the plane without a designated root, using algorithms developed for drawing phylogenies.
layout_as_tree_unrooted(
g,
mode = c("equalangle", "equaldaylight", "stress"),
weights = NA,
daylight_iter = 15,
iter = 500,
tol = 1e-04,
bbox = 30
)
layout_igraph_tree_unrooted(
g,
mode = c("equalangle", "equaldaylight", "stress"),
weights = NA,
daylight_iter = 15,
iter = 500,
tol = 1e-04,
bbox = 30,
circular
)
g |
igraph object. Each connected component must be a tree (acyclic). |
mode |
which algorithm to use. One of |
weights |
possibly a numeric vector with edge weights, interpreted as branch lengths. If this is NULL and the graph has a weight edge attribute, then the attribute is used. If this is NA then unit branch lengths are used (even if the graph has a weight attribute). By default, unit branch lengths are used. |
daylight_iter |
number of refinement sweeps for |
iter |
number of iterations during stress optimization (only used for
|
tol |
stopping criterion for stress optimization (only used for
|
bbox |
width of layout. Only relevant to determine the placement of disconnected components (forests). |
circular |
not used |
Three algorithms are available:
"equalangle" (Felsenstein, 1989): each subtree is allotted an angular
wedge proportional to its number of leaves. Linear time, but can look
crowded on unbalanced trees.
"equaldaylight" (Felsenstein): iteratively equalizes the angular gaps
("daylight") around each internal node, starting from the equal-angle
layout, for a more balanced drawing.
"stress": stress majorization using the patristic (tree path-length)
distances as target distances, reusing the package's stress engine.
Branch lengths (edge weights) are respected when present; otherwise unit lengths are used.
The layout_igraph_* function should not be used directly. It is only used as an argument for plotting with 'igraph'. 'ggraph' natively supports the layout.
matrix of xy coordinates
Felsenstein, J. (1989). PHYLIP - Phylogeny Inference Package (Version 3.2). Cladistics, 5, 164-166.
Bachmaier, C., Brandes, U., & Schlieper, B. (2005). Drawing phylogenetic trees. In International Symposium on Algorithms and Computation (pp. 1110-1121). Springer, Berlin, Heidelberg.
library(igraph)
g <- make_tree(20, 3, mode = "undirected")
xy <- layout_as_tree_unrooted(g)
xy <- layout_as_tree_unrooted(g, mode = "equaldaylight")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.