plotnj: Plot an Unrooted Trees.

View source: R/f_plotnj.r

plotnjR Documentation

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, ...)

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.

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.

Value

Return a tree plot.

Author(s)

Wei-Chen Chen wccsnow@gmail.com

References

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

See Also

plot.phylo, .Color.

Examples

## Not run: 
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")

## End(Not run)

snoweye/phyclust documentation built on Sept. 12, 2023, 5 a.m.