Browse code

add 'multiPhylo' example in 'Tree Visualization' vignette <2016-01-13, Wed>

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@112504 bc3139a8-67e5-0310-9ffc-ced21a209358

g.yu authored on 13/01/2016 08:36:03
Showing 2 changed files

... ...
@@ -1,5 +1,6 @@
1 1
 CHANGES IN VERSION 1.3.9
2 2
 ------------------------
3
+ o add 'multiPhylo' example in 'Tree Visualization' vignette <2016-01-13, Wed>
3 4
  o viewClade, scaleClade, collapse, expand, rotate, flip, get_taxa_name and scale_x_ggtree accepts input tree_view=NULL.
4 5
    these function will access the last plot if tree_view=NULL. <2016-01-13, Wed>
5 6
    + > ggtree(rtree(30)); viewClade(node=35) works. no need to pipe.
... ...
@@ -248,4 +248,31 @@ grid.arrange(
248 248
 	ncol=2)
249 249
 ```
250 250
 
251
+# Visualize a list of trees
252
+
253
+`ggtree` supports `multiPhylo` object and a list of trees can be view simultaneously.
254
+
255
+```{r fig.width=12, fig.height=4}
256
+trees <- lapply(c(10, 20, 40), rtree)
257
+class(trees) <- "multiPhylo"
258
+ggtree(trees) + facet_wrap(~.id, scale="free") + geom_tiplab()
259
+```
260
+
261
+One hundred bootstrap trees can also be view simultaneously.
262
+```{r fig.width=20, fig.height=20}
263
+btrees <- read.tree(system.file("extdata/RAxML", "RAxML_bootstrap.H3", package="ggtree"))
264
+ggtree(btrees) + facet_wrap(~.id, ncol=10)
265
+```
266
+
267
+Another way to view the bootstrap trees is to merge them together to form a density tree. We can add a layer of the best tree on the top of the density tree.
268
+
269
+```{r}
270
+p <- ggtree(btrees, layout="rectangular",   color="lightblue", alpha=.3)
271
+
272
+best_tree <- read.tree(system.file("extdata/RAxML", "RAxML_bipartitionsBranchLabels.H3", package="ggtree"))
273
+df <- fortify(best_tree, branch.length = 'none')
274
+p+geom_tree(data=df, color='firebrick')
275
+```
276
+
277
+
251 278
 # References