ggtreeextra and root length settings

174 views
Skip to first unread message

Antoine

unread,
Nov 22, 2020, 10:56:05 PM11/22/20
to ggtree

Good morning

First of all , thank you for this amazing workI have been using ggtree for a long time now and I have  a couple of questions

#1. First real quick: I can’t find the data to reproduce Fig10.2 from ggtree extra

https://yulab-smu.top/treedata-book/chapter10.html

can you redirect me to the github page or share the link. I have similar data to analyze but I would like to start from this example  to make sure everything is properly formatted


#2. This is more a problem I have been struggling with for some time now . it has to do with the root length and fan tree (and also how to position the scale and labels)

For example:

mytree <- mytree +   xlab("Subst./site")+  xlim(-0.01, NA)+  geom_treescale(x=0, y=0,  fontsize=16, linesize=4, offset=2,width=0.01)

 

clearly the scale bar, the legend and the root length are not ideal. Is there a comprehensive way to adjust these parameters? What if I have to loop over multiple tree files with different branch lengths?

 

Unknown.tiff.pdf

xshua...@163.com

unread,
Nov 22, 2020, 11:31:13 PM11/22/20
to ggtree
1. The dataset is aviable from https://github.com/YuLab-SMU/treedata-book/tree/master/data/HMP_tree

2. the x and y of geom_treescale control the postion of scale. I think you can set smaller fontsize and linesize.  
    The Fig10.2 of ggtreeExtra also has added geom_treescale layer, you can refer it.

Antoine

unread,
Nov 25, 2020, 7:29:27 PM11/25/20
to ggtree
I was able to access the data, thank you!
when running the code for fig 10.2 
I got this error
``
 p <- ggtree(tree, layout="fan", size=0.15, open.angle=5) +
+         geom_hilight(data=nodedf, mapping=aes(node=node),
+                      extendto=6.8, alpha=0.3, fill="grey", color="grey50",
+                      size=0.05) +
+         geom_cladelab(data=labdf, 
+                       mapping=aes(node=node, 
+                                   label=label,
+                                   offset.text=pos),
+                       hjust=0.5,
+                       angle="auto",
+                       barsize=NA,
+                       horizontal=FALSE, 
+                       fontsize=1.4,
+                       fontface="italic"
+         )
Scale for 'y' is already present. Adding another scale for 'y', which will replace the existing scale.
Error in structure(list(node = node, fill = fill, alpha = alpha, extend = extend,  : 
  argument "node" is missing, with no default
``

I copied/pasted the entire code and did not get error messages upfront.

thank you!

xshua...@163.com

unread,
Nov 25, 2020, 10:09:07 PM11/25/20
to ggtree
please update ggtree to lastest version.
the geom_hilight and geom_cladelab of the newest ggtree have supported aesthetic mapping.
Reply all
Reply to author
Forward
0 new messages