add a scale to unrooted tree

95 views
Skip to first unread message

Miguel Morard Pedrouzo

unread,
Feb 21, 2018, 4:41:48 AM2/21/18
to ggtree
I am trying to add a scale to an unrooted tree with geom_treescale, but when I use it, the tree completely collapses and I am not able to set anything that fix it. Anybody has any idea on how to do it ?

Yu, Guangchuang

unread,
Feb 24, 2018, 5:30:08 AM2/24/18
to Miguel Morard Pedrouzo, ggtree

you can set x and y positions manually in geom_treescale. Besides, using +theme_grey() is useful if you have no idea of the coordination.

set.seed(20180224)
x = rtree(30)
ggtree(x, layout='unrooted') -> p
p + ggplot2::theme_grey() + geom_treescale(x=7, y=-5.5, offset=.1)

Inline image 1


On Wed, Feb 21, 2018 at 5:41 PM, Miguel Morard Pedrouzo <miguel...@gmail.com> wrote:
I am trying to add a scale to an unrooted tree with geom_treescale, but when I use it, the tree completely collapses and I am not able to set anything that fix it. Anybody has any idea on how to do it ?

--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.
To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/9d69f444-94cf-42df-8382-bca2962b08c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Postdoc researcher
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
-~----------~----~----~----~------~----~------~--~---

ksw

unread,
May 31, 2023, 5:08:55 PM5/31/23
to ggtree
Dear all,

Thank you for the above messages on this and for a fantastic resource. I am also having trouble adding a tree_scale to an unrooted tree even when I follow the steps above because the coordinates shown with the theme_grey() seem to be inconsistent with those for geom_treescale(). 

I am trying the following, with the attached tree file: 

tre = read.tree('results/tree/vitoria.treefile')

# Add tree_scale
p <- ggtree(tre, layout="unrooted") + ggplot2::theme_grey()
p + geom_treescale(x = .003, y = -.001)

Any suggestions would be fantastic. Thank you very much!





On Saturday, February 24, 2018 at 3:30:08 AM UTC-7 gc...@connect.hku.hk wrote:

you can set x and y positions manually in geom_treescale. Besides, using +theme_grey() is useful if you have no idea of the coordination.

set.seed(20180224)
x = rtree(30)
ggtree(x, layout='unrooted') -> p
p + ggplot2::theme_grey() + geom_treescale(x=7, y=-5.5, offset=.1)

Inline image 1


On Wed, Feb 21, 2018 at 5:41 PM, Miguel Morard Pedrouzo <miguel...@gmail.com> wrote:
I am trying to add a scale to an unrooted tree with geom_treescale, but when I use it, the tree completely collapses and I am not able to set anything that fix it. Anybody has any idea on how to do it ?

--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/9d69f444-94cf-42df-8382-bca2962b08c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
vitoria.treefile
Reply all
Reply to author
Forward
0 new messages