ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

Position and overplotting of geom_treescale

Open ewallace opened this issue 5 years ago • 0 comments
trafficstars

The documentation for geom_treescale doesn't cover how it is positioned. That is a problem because default values can lead to overplotting of the scale on the tree.

library(ape)
set.seed(42)
# construct a large random tree
tree_100  <- rtree(100)

## default position overplots
ggtree(tree_100) + geom_treescale()

## this can be changed
ggtree(tree_100) + geom_treescale(x=0,y=75)

Here, knowing that geom_treescale(x=0,y=75) fixes the issue, depends on knowing that the x co-ordinate is relative to the root in branchlength, and y co-ord is relative to the number of sequences, in layout="rectangular". But as issue #234 says, that doesn't work in other layouts.

I think a minimum fix would be describing how the positioning works in the geom_treescale help file, so that users know how to respond more quickly.

ewallace avatar May 17 '20 16:05 ewallace