Learn R Programming

phyclust (version 0.1-34)

plotnj: Plot an Unrooted Trees.

Description

This is a enhanced version of plot.phylo in ape which can plot trees in Class phylo including neighbor-joining trees, unrooted trees, trees with star shapes, ... etc.

Usage

plotnj(unrooted.tree, X.class = NULL, type = "u", main = NULL,
   show.tip.label = FALSE, show.node.label = FALSE,
   edge.width = 1, edge.width.class = edge.width, ...)

Value

Return a tree plot.

Arguments

unrooted.tree

an unrooted tree in Class phylo.

X.class

class ids indicated for all tips.

type

plot types, see plot.phylo in ape for details.

main

main label.

show.tip.label

show tip label if available.

show.node.label

show node label if available.

edge.width

edge width for all internal branches if X.class is set.

edge.width.class

edge width for tip branches if X.class is set.

...

other options passed to plot.phylo.

Author

Wei-Chen Chen wccsnow@gmail.com

Details

This function is built to plot unrooted trees, but it may also apply for other trees in Class phylo.

type can be "u", "p", "c", "f", "r" as in plot.phylo.

If X.class is set, then the tip branches will be drawn with colors by class ids, and the colors are controlled by .color. The width of branches is controlled by edge.width for all internal branches and by edge.width.class for tip branches.

References

Phylogenetic Clustering Website: https://snoweye.github.io/phyclust/

See Also

plot.phylo, .Color.

Examples

Run this code
if (FALSE) {
library(phyclust, quiet = TRUE)

set.seed(1234)
ret.ms <- ms(nsam = 24, opts = "-T -G 0.5")
tree.anc <- read.tree(text = ret.ms[3])

is.rooted(tree.anc)
tree.new <- as.star.tree(tree.anc)
X.class <- rep(1:6, each = 4)

par(mfrow = c(2, 2))
plotnj(tree.anc, X.class, type = "u", edge.width.class = 2,
       main = "unrooted tree")
plotnj(tree.new, X.class, type = "u", edge.width.class = 2,
       main = "star tree")
plotnj(tree.anc, X.class, type = "c", edge.width.class = 2,
       main = "unrooted tree in cladogram")
plotnj(tree.new, X.class, type = "r", edge.width.class = 2,
       main = "star tree in radial")
}

Run the code above in your browser using DataLab