Commit information:
Commit id: 3a9059183d9a33cff143c90c6a09d6d566c94955
update vignette
Committed by: GuangchuangYu
Author Name: GuangchuangYu
Commit date: 2015-02-02 11:50:41 +0800
Author date: 2015-02-02 11:50:41 +0800
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@98952 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: ggtree |
2 | 2 |
Type: Package |
3 | 3 |
Title: a phylogenetic tree viewer for different types of tree annotations |
4 |
-Version: 0.99.8 |
|
4 |
+Version: 0.99.9 |
|
5 | 5 |
Author: Guangchuang Yu |
6 | 6 |
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com> |
7 | 7 |
Description: ggtree extends the ggplot2 plotting system which implemented the |
... | ... |
@@ -28,6 +28,7 @@ BiocStyle::markdown() |
28 | 28 |
|
29 | 29 |
```{r echo=FALSE, results="hide", message=FALSE} |
30 | 30 |
library("ape") |
31 |
+library("colorspace") |
|
31 | 32 |
library("ggplot2") |
32 | 33 |
library("ggtree") |
33 | 34 |
library("Biostrings") |
... | ... |
@@ -135,7 +136,14 @@ ggtree(tree, showDistance=TRUE) + |
135 | 136 |
vjust=-0.5, color="#F06C45") + |
136 | 137 |
scale_x_continuous(breaks=seq(0, 60, 5)) |
137 | 138 |
``` |
138 |
- |
|
139 |
+ |
|
140 |
+User can also use _`geom_segment`_ and _`geom_text`_ to specify the position and length of distance legend: |
|
141 |
+```{r fig.width=3, fig.height=3, warning=FALSE, fig.align="center"} |
|
142 |
+ggtree(tree) + |
|
143 |
+ geom_segment(x=0, y=12, xend=10, yend=12) + |
|
144 |
+ geom_text(x=5, y=12.5, label=5, size=4) |
|
145 |
+``` |
|
146 |
+ |
|
139 | 147 |
## display nodes/tips |
140 | 148 |
|
141 | 149 |
Show all the internal nodes and tips in the tree can be done by adding a layer of points using _`geom_point`_. |
... | ... |
@@ -152,10 +160,19 @@ p + geom_point(color="#FDAC4F", shape=8, size=3, subset=.(isTip)) |
152 | 160 |
``` |
153 | 161 |
|
154 | 162 |
## display labels |
163 |
+ |
|
164 |
+Users can use _`geom_text`_ to display the node/tip labels: |
|
165 |
+ |
|
155 | 166 |
```{r fig.width=3, fig.height=3, warning=FALSE, fig.align="center"} |
156 | 167 |
p + geom_text(aes(label=label), size=3, color="purple", hjust=-0.3) |
157 | 168 |
``` |
158 | 169 |
|
170 |
+For _`fan`_ and _`unrooted`_ layout, `r Githubpkg("GuangchuangYu/ggtree")` supports rotating node labels according to the angles of the branches. |
|
171 |
+```{r fig.width=6, fig.height=6, warning=FALSE, fig.align="center"} |
|
172 |
+ggtree(tree, layout="fan") + geom_text(aes(label=label, angle=angle), size=3, color="purple", vjust=-0.3) |
|
173 |
+``` |
|
174 |
+ |
|
175 |
+ |
|
159 | 176 |
By default, the positions are based on the node positions, we can change them to based on the middle of the branch/edge. |
160 | 177 |
|
161 | 178 |
```{r fig.width=5, fig.height=3, warning=FALSE, fig.align="center"} |
... | ... |
@@ -510,7 +527,7 @@ gplot(p2, dd, low="green", high="red", widths=c(.7, .3)) |
510 | 527 |
```{r fig.width=18, fig.height=10, fig.align="center"} |
511 | 528 |
library("ape") |
512 | 529 |
data(chiroptera) |
513 |
-require(ggtree) |
|
530 |
+library("ggtree") |
|
514 | 531 |
gzoom(chiroptera, grep("Plecotus", chiroptera$tip.label)) |
515 | 532 |
``` |
516 | 533 |
|
... | ... |
@@ -604,6 +621,18 @@ ggtree(tree_iris, color=cols[cls_ind]) %<+% species + |
604 | 621 |
|
605 | 622 |
This example demonstrates how the separation of the _`bionj`_ is very good with the _`setosa`_ species, but misses in labeling several _`versicolor`_ and _`virginica`_ species. |
606 | 623 |
|
624 |
+## phylopic |
|
625 |
+ |
|
626 |
+[PhyloPic](http://phylopic.org/) is a database that stores reusable silhouette images of organisms. `r Githubpkg("GuangchuangYu/ggtree")` supports downloading images from [PhyloPic](http://phylopic.org/) and annotating phylogenetic tree with the downloaded images. |
|
627 |
+ |
|
628 |
+```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
629 |
+cols <- rainbow_hcl(2) |
|
630 |
+x <- get.phylopic("d3563b54-780f-4711-a49a-7ea051e9dacc", size=512, color=cols[1], alpha=.3) |
|
631 |
+y <- get.phylopic("3318565d-7531-4a8c-8b84-2e87dfae36ab", size=512, color=cols[2], alpha=.8) |
|
632 |
+ggtree(tree) + annotation_custom(xmin=-Inf, ymin=-Inf, xmax=Inf, ymax=Inf, x) + |
|
633 |
+ annotation_custom(xmin=15, ymin=2, xmax=25, ymax=4, y) |
|
634 |
+``` |
|
635 |
+ |
|
607 | 636 |
|
608 | 637 |
|
609 | 638 |
# Session info |