ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

bug in rotate

Open FelixErnst opened this issue 4 years ago • 2 comments

Hi,

rotate behaves peculiar, when rotating a node of a tree.

# data from tree book
tree <- read.tree("data/HMP_tree/hmptree.nwk")
p <- ggtree(tree)
p
ggtree::rotate(p, 5)

image image

The branch of node 5 disappears. This is reproducable with layout = "fan" and all other nodes I have tested.

In addition the man page of rotate contains an error.

node internal node number to specify a clade. If NULL, using the whole tree

Not defining node or setting it to NULL results in an error.

> ggtree::rotate(p)
Error in offspring.tbl_tree(df, node) : .node is required

FelixErnst avatar Feb 10 '21 15:02 FelixErnst

the node should be internal node number.

xiangpin avatar Feb 22 '21 11:02 xiangpin

Ah ok. Thanks for the info.

But shouldn't rotation around a tip node result in the same output? Currently the parent node just gets removed/omited

FelixErnst avatar Feb 22 '21 12:02 FelixErnst