flip: flip

View source: R/clade-functions.R

flipR Documentation

flip

Description

exchange the position of 2 clades

Usage

flip(tree_view = NULL, node1, node2)

Arguments

tree_view

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

node1

node number of clade 1. It should share a same parent node with node2

node2

node number of clade 2. It should share a same parent node with node1

Value

ggplot object

Author(s)

Guangchuang Yu

Examples

set.seed(123)
x <- rtree(15)
p <- ggtree(x) + geom_tiplab() +
  geom_nodelab(aes(subset=!isTip, label=node), hjust = -.1, color = "red")
flip(p, 23, 24)   ## Depends on the condition of your tree

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