Description Usage Arguments Value Author(s) Examples
View source: R/tree_signalNode.R
signalNode
is to represent some nodes with their ancestor to make
result as short as possible. The ancestors share exactly the same leaves as
the original nodes.
1 | signalNode(tree, node, use.alias = FALSE)
|
tree |
A tree (phylo object) |
node |
A vector of node numbers or node labels |
use.alias |
A logical value, TRUE or FALSE. The default is FALSE, and
the node label would be used to name the output; otherwise, the alias of
node label would be used to name the output. The alias of node label is
created by adding a prefix |
A vector of nodes. The numeric value is the node number, and the
vector name is the corresponding node label. If a node has no label, it
would have NA as name when use.alias = FALSE
, and have the alias of
node label as name when use.alias = TRUE
.
Ruizhu Huang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data(tinyTree)
library(ggtree)
# PLOT tree
# The node labels are in orange texts and the node numbers are in blue
ggtree(tinyTree,branch.length = 'none')+
geom_text2(aes(label = label), color = "darkorange",
hjust = -0.1, vjust = -0.7) +
geom_text2(aes(label = node), color = "darkblue",
hjust = -0.5, vjust = 0.7)
## find the node shared by provided node labels
signalNode(node = c('t4','t9'), tree = tinyTree)
signalNode(node = c('t4','t9'), tree = tinyTree)
signalNode(node = c('t10','Node_18', 't8'), tree = tinyTree,
use.alias = FALSE)
signalNode(node = c('t10','Node_18', 't8'), tree = tinyTree,
use.alias = TRUE)
## find the node shared by provided node numbers
signalNode(node = c(2, 3), tree = tinyTree)
signalNode(node = c(2, 3, 16), tree = tinyTree)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.