how to set x axis limits and title for the tree panel ?

639 views
Skip to first unread message

qinda...@gmail.com

unread,
Nov 16, 2016, 6:57:00 AM11/16/16
to ggtree
The facet_plot function created a picture with two panels, "tree" and "bar". But the tiplab of the tree is a little long that it was covered partly by the bar panel. When I tried to use "xlim_tree" function to expand the tree panel's x axis limits, errors occured (Error: could not find function "xlim_tree"). I used the latest ggtree(v 1.6.4) from bioconductor, and my R version was 3.3.2. Besides, the defult title of the tree panel was "Tree", how to change it to some others?


gc...@connect.hku.hk

unread,
Nov 16, 2016, 8:04:36 AM11/16/16
to ggtree
If you follow the welcome msg of the group, you can find your first answer in https://guangchuangyu.github.io/ggtree/faq/

For second issue of changing the facet label, you need to use theme, http://docs.ggplot2.org/current/theme.html

cool_a...@web.de

unread,
Dec 27, 2016, 10:32:05 AM12/27/16
to ggtree
I can't install the deval branch of ggtree, because it requires treeio which requires the devel branch of Bioconductor which requires an installation of R-devel on the hard drive, which needs administrative privilige, which an ordinary research assistant does not have :(

Yu, Guangchuang

unread,
Dec 27, 2016, 11:20:57 AM12/27/16
to cool_a...@web.de, ggtree
treeio depends on release version of R, see http://bioconductor.org/packages/devel/bioc/html/treeio.html

On Tue, Dec 27, 2016 at 11:32 PM, <cool_a...@web.de> wrote:
I can't install the deval branch of ggtree, because it requires treeio which requires the devel branch of Bioconductor which requires an installation of R-devel on the hard drive, which needs administrative privilige, which an ordinary research assistant does not have :(

--
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/11518b9c-0654-4e79-9d5f-6b89c45937ed%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



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

cool_a...@web.de

unread,
Dec 31, 2016, 4:27:50 PM12/31/16
to ggtree
Oh sorry, maybe i got confused because it says:

package ‘treeio’ is not available (for R version 3.3.2)

and it says on Bioconductor: This is the development version of treeio; to use it, please install the devel version of Bioconductor. *follow link*--> In order to use the devel version of Bioconductor during the current release cycle, you must install R-devel

I will try to install it :) Thanks for the help!

Jean-Baka Domelevo Entfellner

unread,
Aug 21, 2018, 5:33:01 AM8/21/18
to ggtree
I post this because I am facing the same problem: I want to change the text of the label (not the font, the face, the colour, etc: the text itself) of the leftmost panel which is automatically called "Tree" by ggtree. As far as I understand, and contrary to what is posted below, the "theme" thing of ggplot2 only allows to change the appearance of the panel header, not the text of the panel title itself... So how to go about that?

Many thanks,
   JB

Yu, Guangchuang

unread,
Sep 10, 2018, 6:18:18 AM9/10/18
to Jean-Baka Domelevo Entfellner, ggtree

using ggtree v >= 1.13.4, we can use facet_labeller to label facet panels.

library(ggtree)
tr <- rtree(30) 
p <- ggtree(tr)
d1 <- data.frame(id=tr$tip.label, location=sample(c("GZ", "HK", "CZ"), 30, replace=TRUE))
p1 <- p %<+% d1 + geom_tippoint(aes(color=location))
d2 <- data.frame(id=tr$tip.label, val=rnorm(30, sd=3))
p2 <- facet_plot(p1, panel="dot", data=d2, geom=geom_point,
 aes(x=val), color='firebrick') + theme_tree2() lbs <- c(Tree = "tree panel", dot = "dot panel") facet_labeller(p2, lbs)

--
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/software/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.

For more options, visit https://groups.google.com/d/optout.



--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Professor
School of Basic Medical Sciences
Southern Medical University
Guangzhou, China
-~----------~----~----~----~------~----~------~--~---
Reply all
Reply to author
Forward
0 new messages