... | ... |
@@ -20,6 +20,9 @@ |
20 | 20 |
##' facet_plot(p, 'Trait', data = dd, geom=geom_point, mapping=aes(x=value)) |
21 | 21 |
##' @export |
22 | 22 |
##' @author Guangchuang Yu |
23 |
+##' @references G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
24 |
+##' on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
25 |
+##' <https://doi.org/10.1093/molbev/msy194> |
|
23 | 26 |
facet_plot <- function(p, mapping=NULL, data, geom, panel, ...) { |
24 | 27 |
p + geom_facet(panel = panel, data = data, |
25 | 28 |
geom = geom, mapping = mapping, ...) |
... | ... |
@@ -44,6 +47,9 @@ geom_facet <- function(mapping=NULL, data, geom, panel, ...) { |
44 | 47 |
##' @return data frame or a list of data frames |
45 | 48 |
##' @export |
46 | 49 |
##' @author Guangchuang Yu |
50 |
+##' @references G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
51 |
+##' on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
52 |
+##' <https://doi.org/10.1093/molbev/msy194> |
|
47 | 53 |
facet_data <- function(tree_view, panel) { |
48 | 54 |
n <- length(tree_view$layers) |
49 | 55 |
j <- which(vapply(1:n, function(i) { |
... | ... |
@@ -27,8 +27,16 @@ |
27 | 27 |
##' @export |
28 | 28 |
##' @author Yu Guangchuang |
29 | 29 |
##' @seealso [ape::ladderize()] |
30 |
+##' @references 1. G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
31 |
+##' on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
32 |
+##' <https://doi.org/10.1093/molbev/msy194> |
|
33 |
+##' |
|
34 |
+##' 2. G Yu, DK Smith, H Zhu, Y Guan, TTY Lam (2017). ggtree: an R package for |
|
35 |
+##' visualization and annotation of phylogenetic trees with their covariates and |
|
36 |
+##' other associated data. Methods in Ecology and Evolution, 8(1):28-36. |
|
37 |
+##' <https://doi.org/10.1111/2041-210X.12628> |
|
30 | 38 |
##' @examples |
31 |
-##' require(ape) |
|
39 |
+##' require(ape) |
|
32 | 40 |
##' tr <- rtree(10) |
33 | 41 |
##' ggtree(tr) |
34 | 42 |
ggtree <- function(tr, |
... | ... |
@@ -87,13 +95,15 @@ ggtree <- function(tr, |
87 | 95 |
p <- p + geom_tree(layout=layout, multiPhylo=multiPhylo, ...) |
88 | 96 |
|
89 | 97 |
|
90 |
- p <- p + theme_tree() + |
|
91 |
- scale_y_continuous(expand = expand_scale(0, 0.6)) |
|
98 |
+ p <- p + theme_tree() |
|
92 | 99 |
|
93 | 100 |
if (layout == "circular" || layout == "radial") { |
94 | 101 |
p <- p + layout_circular() |
95 | 102 |
} else if (layout == "fan") { |
96 | 103 |
p <- p + layout_fan(open.angle) |
104 |
+ } else { |
|
105 |
+ p <- p + |
|
106 |
+ scale_y_continuous(expand = expand_scale(0, 0.6)) |
|
97 | 107 |
} |
98 | 108 |
|
99 | 109 |
class(p) <- c("ggtree", class(p)) |
... | ... |
@@ -40,6 +40,9 @@ |
40 | 40 |
##' value=round(abs(rnorm(13, mean=70, sd=10)), digits=1)) |
41 | 41 |
##' row.names(dd) <- NULL |
42 | 42 |
##' p %<+% dd + geom_text(aes(color=place, label=label), hjust=-0.5) |
43 |
+##' @references G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
44 |
+##' on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
45 |
+##' <https://doi.org/10.1093/molbev/msy194> |
|
43 | 46 |
`%<+%` <- function(pg, data) { |
44 | 47 |
if (! is.data.frame(data)) { |
45 | 48 |
stop("input should be a data.frame...") |
... | ... |
@@ -27,6 +27,11 @@ dd <- data.frame(taxa=LETTERS[1:13], |
27 | 27 |
row.names(dd) <- NULL |
28 | 28 |
p \%<+\% dd + geom_text(aes(color=place, label=label), hjust=-0.5) |
29 | 29 |
} |
30 |
+\references{ |
|
31 |
+G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
32 |
+on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
33 |
+\url{https://doi.org/10.1093/molbev/msy194} |
|
34 |
+} |
|
30 | 35 |
\author{ |
31 | 36 |
Guangchuang Yu |
32 | 37 |
} |
... | ... |
@@ -39,6 +39,11 @@ dd = data.frame(id=tr$tip.label, value=abs(rnorm(10))) |
39 | 39 |
p <- ggtree(tr) |
40 | 40 |
facet_plot(p, 'Trait', data = dd, geom=geom_point, mapping=aes(x=value)) |
41 | 41 |
} |
42 |
+\references{ |
|
43 |
+G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
44 |
+on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
45 |
+\url{https://doi.org/10.1093/molbev/msy194} |
|
46 |
+} |
|
42 | 47 |
\author{ |
43 | 48 |
Guangchuang Yu |
44 | 49 |
} |
... | ... |
@@ -17,6 +17,11 @@ data frame or a list of data frames |
17 | 17 |
\description{ |
18 | 18 |
extract data used in \code{facet_plot} or \code{geom_facet} |
19 | 19 |
} |
20 |
+\references{ |
|
21 |
+G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
22 |
+on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
23 |
+\url{https://doi.org/10.1093/molbev/msy194} |
|
24 |
+} |
|
20 | 25 |
\author{ |
21 | 26 |
Guangchuang Yu |
22 | 27 |
} |
... | ... |
@@ -54,10 +54,21 @@ Methods in Ecology and Evolution 2017, 8(1):28-36, doi:10.1111/2041-210X.12628 |
54 | 54 |
drawing phylogenetic tree from phylo object |
55 | 55 |
} |
56 | 56 |
\examples{ |
57 |
-require(ape) |
|
57 |
+require(ape) |
|
58 | 58 |
tr <- rtree(10) |
59 | 59 |
ggtree(tr) |
60 | 60 |
} |
61 |
+\references{ |
|
62 |
+\enumerate{ |
|
63 |
+\item G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
|
64 |
+on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
|
65 |
+\url{https://doi.org/10.1093/molbev/msy194} |
|
66 |
+\item G Yu, DK Smith, H Zhu, Y Guan, TTY Lam (2017). ggtree: an R package for |
|
67 |
+visualization and annotation of phylogenetic trees with their covariates and |
|
68 |
+other associated data. Methods in Ecology and Evolution, 8(1):28-36. |
|
69 |
+\url{https://doi.org/10.1111/2041-210X.12628} |
|
70 |
+} |
|
71 |
+} |
|
61 | 72 |
\seealso{ |
62 | 73 |
\code{\link[ape:ladderize]{ape::ladderize()}} |
63 | 74 |
} |