collapse: collapse-ggtree

collapse.ggtreeR Documentation

collapse-ggtree

Description

collapse a selected clade, which can later be expanded with the 'expand()' fuction if necessary

Usage

## S3 method for class 'ggtree'
collapse(x = NULL, node, mode = "none", clade_name = NULL, ...)

Arguments

x

tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot will be used.

node

internal node number

mode

one of 'none'(default), 'max', 'min' and 'mixed'. 'none' would simply collapse the clade as 'tip' and the rest will display a triangle, whose shape is determined by the farest/closest tip of the collapsed clade to indicate it

clade_name

set a name for the collapsed clade. If clade_name = NULL, do nothing

...

additional parameters to set the color or transparency of the triangle

Value

tree view

Author(s)

Guangchuang Yu

See Also

expand

Examples

x <- rtree(15)
p <- ggtree(x) + geom_tiplab()
p
p1 <- collapse(p, node = 17, mode = "mixed", 
               clade_name = "cclade", alpha = 0.8, 
               color = "grey", fill = "light blue")

YuLab-SMU/ggtree documentation built on Nov. 3, 2024, 4:15 p.m.