plotcollapse.phylo: Plot phylogenetic tree with nodes collapsed.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plotcollapse.phylo.R

Description

This function plot phylogenetic tree with nodes collapsed. All arguments used are of the function plot.phylo. See details.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plotcollapse.phylo(
  tree,
  nodes,
  show.tip.label = TRUE,
  show.node.label = FALSE,
  edge.color = "black",
  edge.width = 1,
  edge.lty = 1,
  polygon.color = "gray",
  density = NULL,
  border = NULL,
  nhchar = 2,
  text.nodes.color = NULL,
  ...
)

Arguments

tree

phylogeny as an object of class "phylo".

nodes

a vector with node label to collapse the edges.

show.tip.label

a logical indicating whether to show the tip labels on the phylogeny. The same used in the function plot.phylo (default show.tip.label = TRUE).

show.node.label

a logical indicating whether to show the node labels on the phylogeny. The same used in the function plot.phylo (default show.node.label = FALSE).

edge.color

a vector of colours giving the colours used to draw the branches of the plotted phylogeny. The same used in the function plot.phylo (default edge.color = "black").

edge.width

a numeric vector giving the width of the branches of the plotted phylogeny. The same used in the function plot.phylo (default edge.width = 1).

edge.lty

a numeric vector giving the line types of the branches of the plotted phylogeny. The same used in the function plot.phylo (default edge.lty = 1).

polygon.color

a vector of colours for each node collapsed, this is used to filling each polygon (default polygon.color = "gray").

density

a numeric vector with density of shading lines (lines per inch) for each node collapsed, this is used to filling each polygon (default density = NULL).

border

a vector of colours for each node collapsed, this is used to draw the border in each polygon (default border = NULL).

nhchar

number of hidden characters in tip.labels. This adjusts the margin of tip or nodes names are not shown completely (default nhchar = 2).

text.nodes.color

a vector of colours to text label in each nodes collapsed. If NULL color of text is same that tip.label (default text.nodes.color = NULL).

...

other arguments to function plot.phylo.

Details

The function use the function plot.phylo to plot the phylonenies. This function only hidden all edge, node labels and tips labels of each collapsed node and draw a polygon that represent a collapsed node. Type "phylogram" and "cladogram" work properly, other type of phyloneny will be implemented in future (Tip labels are not draw in correct position). The function compact.tree can be used to compact tips of phylogenetic tree before plot. The function graphical.node.patterns can be used to define graphical parameters (e.g. color, width and line types) for each edge in phylogenetic tree.

This function require node labels. The function makeNodeLabel or node.tree can be used to make node labels before plot, anyway the the function node.tree is apply automatically. Make sure that that there no conflict with node labels.

Value

The plot of phylogenetic trees with nodes collapsed and returns invisibly a list with components which values are those used for the plot. See details in plot.phylo.

Author(s)

Vanderlei Julio Debastiani <vanderleidebastiani@yahoo.com.br>

See Also

plot.phylo compact.tree graphical.node.patterns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
set.seed(10)
tree<-rtree(15)
tree <- makeNodeLabel(tree)
plot.phylo(tree, show.node.label = TRUE)
nodes <- c("Node6", "Node13")

plot.phylo(tree, show.node.label = TRUE)
plotcollapse.phylo(tree, nodes)
plotcollapse.phylo(tree, nodes, nhchar = 5) # nhchar ajust the margin
plotcollapse.phylo(tree, nodes, show.tip.label = FALSE)
plotcollapse.phylo(tree, nodes, direction = "rightwards", polygon.color = c("red","blue"))
plotcollapse.phylo(tree, nodes, direction = "rightwards", polygon.color = c("red","blue"), 
   text.nodes.color = c("red", "blue"))
plotcollapse.phylo(tree, nodes, direction = "upwards", polygon.color = c("red","blue"))
plotcollapse.phylo(tree, nodes, direction = "downwards", polygon.color = c("red","blue"))
plotcollapse.phylo(tree, nodes, direction = "leftwards", polygon.color = c("red","blue"))
plotcollapse.phylo(tree, nodes, direction = "leftwards", polygon.color = c("red","blue"), 
   nhchar = 6)

set.seed(20)
tree <- rtree(15)
tree <- makeNodeLabel(tree)
plot.phylo(tree, show.node.label = TRUE)
tree.compacted <- compact.tree(tree, "Node6")
plot.phylo(tree.compacted, show.node.label = TRUE) # plot tree compacted
nodes <- c("Node5","Node7")
plotcollapse.phylo(tree, nodes, nhchar = 4)
plotcollapse.phylo(tree.compacted, nodes, nhchar = 4)

e.wid <- graphical.node.patterns(tree, nodes, basicpattern = 1, 
    nodespatterns = 3, include.node = TRUE)
e.wid
plotcollapse.phylo(tree, nodes, show.node.label = TRUE, edge.width = e.wid)
e.col <- graphical.node.patterns(tree, nodes, basicpattern = "black", 
    nodespatterns = c("red","blue"), include.node = TRUE)
e.col
plotcollapse.phylo(tree, nodes, show.node.label = TRUE, edge.width = e.wid, edge.color = e.col)

tree <- rtree(50)
tree <- compute.brlen(tree)
tree <- makeNodeLabel(tree)
plot.phylo(tree, type ="fan", show.tip.label = FALSE)
nodes <- "Node30"
plotcollapse.phylo(tree, nodes, type ="fan", show.tip.label = FALSE)

vanderleidebastiani/daee documentation built on Jan. 22, 2021, 2:41 p.m.