... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
##' @param root.position position of the root node (default = 0) |
18 | 18 |
##' @param xlim x limits, only works for 'inward_circular' layout |
19 | 19 |
##' @param layout.params list, the parameters of layout, when layout is a function. |
20 |
+##' @param hang numeric The fraction of the tree plot height by which labels should hang |
|
21 |
+##' below the rest of the plot. A negative value will cause the labels to hang down from 0. This |
|
22 |
+##' parameter only work with the 'dendrogram' layout for 'hclust' like class, default is 0.1. |
|
20 | 23 |
##' @return tree |
21 | 24 |
##' @importFrom ggplot2 ggplot |
22 | 25 |
##' @importFrom ggplot2 xlab |
... | ... |
@@ -59,6 +62,7 @@ ggtree <- function(tr, |
59 | 62 |
root.position = 0, |
60 | 63 |
xlim = NULL, |
61 | 64 |
layout.params = list(), |
65 |
+ hang = .1, |
|
62 | 66 |
...) { |
63 | 67 |
|
64 | 68 |
# Check if layout string is valid. |
... | ... |
@@ -102,6 +106,7 @@ ggtree <- function(tr, |
102 | 106 |
right = right, |
103 | 107 |
branch.length = branch.length, |
104 | 108 |
root.position = root.position, |
109 |
+ hang = hang, |
|
105 | 110 |
...) |
106 | 111 |
|
107 | 112 |
if (!is.null(dd)){ |
... | ... |
@@ -37,6 +37,10 @@ |
37 | 37 |
##' visualization and annotation of phylogenetic trees with their covariates and |
38 | 38 |
##' other associated data. Methods in Ecology and Evolution, 8(1):28-36. |
39 | 39 |
##' <https://doi.org/10.1111/2041-210X.12628> |
40 |
+##' |
|
41 |
+##' For more information, please refer to |
|
42 |
+##' *Data Integration, Manipulation and Visualization of Phylogenetic Trees* |
|
43 |
+##' <http://yulab-smu.top/treedata-book/index.html> by Guangchuang Yu. |
|
40 | 44 |
##' @examples |
41 | 45 |
##' require(ape) |
42 | 46 |
##' tr <- rtree(10) |
... | ... |
@@ -101,6 +101,8 @@ ggtree <- function(tr, |
101 | 101 |
...) |
102 | 102 |
|
103 | 103 |
if (!is.null(dd)){ |
104 |
+ message_wrap("The tree object will be displayed with graph layout since |
|
105 |
+ layout argument was specified the graph layout function.") |
|
104 | 106 |
p$data <- dplyr::left_join( |
105 | 107 |
p$data %>% select(-c("x", "y")), |
106 | 108 |
dd, |
... | ... |
@@ -16,6 +16,7 @@ |
16 | 16 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
17 | 17 |
##' @param root.position position of the root node (default = 0) |
18 | 18 |
##' @param xlim x limits, only works for 'inward_circular' layout |
19 |
+##' @param layout.params list, the parameters of layout, when layout is a function. |
|
19 | 20 |
##' @return tree |
20 | 21 |
##' @importFrom ggplot2 ggplot |
21 | 22 |
##' @importFrom ggplot2 xlab |
... | ... |
@@ -53,12 +54,22 @@ ggtree <- function(tr, |
53 | 54 |
branch.length = "branch.length", |
54 | 55 |
root.position = 0, |
55 | 56 |
xlim = NULL, |
57 |
+ layout.params = list(), |
|
56 | 58 |
...) { |
57 | 59 |
|
58 | 60 |
# Check if layout string is valid. |
59 |
- layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", 'inward_circular', |
|
61 |
+ trash <- try(silent = TRUE, |
|
62 |
+ expr = { |
|
63 |
+ layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", 'inward_circular', |
|
60 | 64 |
"radial", "unrooted", "equal_angle", "daylight", "dendrogram", |
61 | 65 |
"ape", "ellipse", "roundrect")) |
66 |
+ } |
|
67 |
+ ) |
|
68 |
+ |
|
69 |
+ dd <- check.graph.layout(tr, trash, layout, layout.params) |
|
70 |
+ if (inherits(trash, "try-error") && !is.null(dd)){ |
|
71 |
+ layout <- "rectangular" |
|
72 |
+ } |
|
62 | 73 |
|
63 | 74 |
if (layout == "unrooted") { |
64 | 75 |
layout <- "daylight" |
... | ... |
@@ -89,6 +100,15 @@ ggtree <- function(tr, |
89 | 100 |
root.position = root.position, |
90 | 101 |
...) |
91 | 102 |
|
103 |
+ if (!is.null(dd)){ |
|
104 |
+ p$data <- dplyr::left_join( |
|
105 |
+ p$data %>% select(-c("x", "y")), |
|
106 |
+ dd, |
|
107 |
+ by = "node" |
|
108 |
+ ) |
|
109 |
+ layout <- "equal_angle" |
|
110 |
+ } |
|
111 |
+ |
|
92 | 112 |
if (is(tr, "multiPhylo")) { |
93 | 113 |
multiPhylo <- TRUE |
94 | 114 |
} else { |
... | ... |
@@ -154,3 +174,30 @@ ggtree_references <- function() { |
154 | 174 |
"<http://yulab-smu.top/treedata-book/>\n" |
155 | 175 |
) |
156 | 176 |
} |
177 |
+ |
|
178 |
+check.graph.layout <- function(tr, trash, layout, layout.params){ |
|
179 |
+ if (inherits(trash, "try-error")){ |
|
180 |
+ gp <- ape::as.igraph.phylo(as.phylo(tr), use.labels = FALSE) |
|
181 |
+ #dd <- ggraph::create_layout(gp, layout = layout) |
|
182 |
+ if (is.function(layout)){ |
|
183 |
+ dd <- do.call(layout, c(list(gp), layout.params)) |
|
184 |
+ if (!inherits(dd, "matrix")){ |
|
185 |
+ if ("xy" %in% names(dd)){ |
|
186 |
+ dd <- dd$xx |
|
187 |
+ }else if ("layout" %in% names(dd)){ |
|
188 |
+ dd <- dd$layout |
|
189 |
+ }else{ |
|
190 |
+ stop(trash, call. = FALSE) |
|
191 |
+ } |
|
192 |
+ } |
|
193 |
+ dd <- data.frame(dd) |
|
194 |
+ colnames(dd) <- c("x", "y") |
|
195 |
+ dd$node <- seq_len(nrow(dd)) |
|
196 |
+ }else{ |
|
197 |
+ stop(trash, call. = FALSE) |
|
198 |
+ } |
|
199 |
+ }else{ |
|
200 |
+ dd <- NULL |
|
201 |
+ } |
|
202 |
+ return(dd) |
|
203 |
+} |
... | ... |
@@ -131,18 +131,18 @@ ggtree_citations <- function() { |
131 | 131 |
paste0('1. ', |
132 | 132 |
"Guangchuang Yu. ", |
133 | 133 |
"Using ggtree to visualize data on tree-like structures. ", |
134 |
- "Current Protocols in Bioinformatics, 2020, 69:e96. doi:10.1002/cpbi.96\n", |
|
134 |
+ "Current Protocols in Bioinformatics. 2020, 69:e96. doi:10.1002/cpbi.96\n", |
|
135 | 135 |
|
136 | 136 |
'2. ', |
137 | 137 |
"Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. ", |
138 | 138 |
"Two methods for mapping and visualizing associated data on phylogeny using ggtree. ", |
139 |
- "Molecular Biology and Evolution 2018, 35(12):3041-3043. doi:10.1093/molbev/msy194\n", |
|
139 |
+ "Molecular Biology and Evolution. 2018, 35(12):3041-3043. doi:10.1093/molbev/msy194\n", |
|
140 | 140 |
|
141 | 141 |
# '\033[36m', '-', '\033[39m ', |
142 | 142 |
"3. ", |
143 | 143 |
"Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ", |
144 | 144 |
"ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ", |
145 |
- "Methods in Ecology and Evolution 2017, 8(1):28-36. doi:10.1111/2041-210X.12628\n" |
|
145 |
+ "Methods in Ecology and Evolution. 2017, 8(1):28-36. doi:10.1111/2041-210X.12628\n" |
|
146 | 146 |
) |
147 | 147 |
} |
148 | 148 |
|
... | ... |
@@ -27,7 +27,7 @@ |
27 | 27 |
##' @importFrom ggplot2 coord_polar |
28 | 28 |
##' @export |
29 | 29 |
##' @author Yu Guangchuang |
30 |
-##' @seealso [ape::ladderize()] |
|
30 |
+##' @seealso [geom_tree()] |
|
31 | 31 |
##' @references 1. G Yu, TTY Lam, H Zhu, Y Guan (2018). Two methods for mapping and visualizing associated data |
32 | 32 |
##' on phylogeny using ggtree. Molecular Biology and Evolution, 35(2):3041-3043. |
33 | 33 |
##' <https://doi.org/10.1093/molbev/msy194> |
... | ... |
@@ -125,3 +125,32 @@ ggtree <- function(tr, |
125 | 125 |
|
126 | 126 |
return(p) |
127 | 127 |
} |
128 |
+ |
|
129 |
+ |
|
130 |
+ggtree_citations <- function() { |
|
131 |
+ paste0('1. ', |
|
132 |
+ "Guangchuang Yu. ", |
|
133 |
+ "Using ggtree to visualize data on tree-like structures. ", |
|
134 |
+ "Current Protocols in Bioinformatics, 2020, 69:e96. doi:10.1002/cpbi.96\n", |
|
135 |
+ |
|
136 |
+ '2. ', |
|
137 |
+ "Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. ", |
|
138 |
+ "Two methods for mapping and visualizing associated data on phylogeny using ggtree. ", |
|
139 |
+ "Molecular Biology and Evolution 2018, 35(12):3041-3043. doi:10.1093/molbev/msy194\n", |
|
140 |
+ |
|
141 |
+ # '\033[36m', '-', '\033[39m ', |
|
142 |
+ "3. ", |
|
143 |
+ "Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ", |
|
144 |
+ "ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ", |
|
145 |
+ "Methods in Ecology and Evolution 2017, 8(1):28-36. doi:10.1111/2041-210X.12628\n" |
|
146 |
+ ) |
|
147 |
+} |
|
148 |
+ |
|
149 |
+ |
|
150 |
+ggtree_references <- function() { |
|
151 |
+ paste0(ggtree_citations(), "\n", |
|
152 |
+ "For more information, please refer to the online book:", |
|
153 |
+ "Data Integration, Manipulation and Visualization of Phylogenetic Trees.", |
|
154 |
+ "<http://yulab-smu.top/treedata-book/>\n" |
|
155 |
+ ) |
|
156 |
+} |
... | ... |
@@ -58,7 +58,7 @@ ggtree <- function(tr, |
58 | 58 |
# Check if layout string is valid. |
59 | 59 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", 'inward_circular', |
60 | 60 |
"radial", "unrooted", "equal_angle", "daylight", "dendrogram", |
61 |
- "ape", "ellipse")) |
|
61 |
+ "ape", "ellipse", "roundrect")) |
|
62 | 62 |
|
63 | 63 |
if (layout == "unrooted") { |
64 | 64 |
layout <- "daylight" |
... | ... |
@@ -58,7 +58,7 @@ ggtree <- function(tr, |
58 | 58 |
# Check if layout string is valid. |
59 | 59 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", 'inward_circular', |
60 | 60 |
"radial", "unrooted", "equal_angle", "daylight", "dendrogram", |
61 |
- "ape")) |
|
61 |
+ "ape", "ellipse")) |
|
62 | 62 |
|
63 | 63 |
if (layout == "unrooted") { |
64 | 64 |
layout <- "daylight" |
... | ... |
@@ -57,7 +57,7 @@ ggtree <- function(tr, |
57 | 57 |
|
58 | 58 |
# Check if layout string is valid. |
59 | 59 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", 'inward_circular', |
60 |
- "radial", "unrooted", "equal_angle", "daylight", |
|
60 |
+ "radial", "unrooted", "equal_angle", "daylight", "dendrogram", |
|
61 | 61 |
"ape")) |
62 | 62 |
|
63 | 63 |
if (layout == "unrooted") { |
... | ... |
@@ -106,6 +106,8 @@ ggtree <- function(tr, |
106 | 106 |
p <- p + layout_inward_circular(xlim = xlim) |
107 | 107 |
} else if (layout == "fan") { |
108 | 108 |
p <- p + layout_fan(open.angle) |
109 |
+ } else if (layout == "dendrogram") { |
|
110 |
+ p <- p + layout_dendrogram() |
|
109 | 111 |
} else if (layout %in% c("daylight", "equal_angle", "ape")) { |
110 | 112 |
p <- p + ggplot2::coord_fixed() |
111 | 113 |
d <- p$data |
... | ... |
@@ -15,6 +15,7 @@ |
15 | 15 |
##' right-hand side? See [ape::ladderize()] for more information. |
16 | 16 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
17 | 17 |
##' @param root.position position of the root node (default = 0) |
18 |
+##' @param xlim x limits, only works for 'inward_circular' layout |
|
18 | 19 |
##' @return tree |
19 | 20 |
##' @importFrom ggplot2 ggplot |
20 | 21 |
##' @importFrom ggplot2 xlab |
... | ... |
@@ -51,10 +52,11 @@ ggtree <- function(tr, |
51 | 52 |
right = FALSE, |
52 | 53 |
branch.length = "branch.length", |
53 | 54 |
root.position = 0, |
55 |
+ xlim = NULL, |
|
54 | 56 |
...) { |
55 | 57 |
|
56 | 58 |
# Check if layout string is valid. |
57 |
- layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", |
|
59 |
+ layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", 'inward_circular', |
|
58 | 60 |
"radial", "unrooted", "equal_angle", "daylight", |
59 | 61 |
"ape")) |
60 | 62 |
|
... | ... |
@@ -100,6 +102,8 @@ ggtree <- function(tr, |
100 | 102 |
|
101 | 103 |
if (layout == "circular" || layout == "radial") { |
102 | 104 |
p <- p + layout_circular() |
105 |
+ } else if (layout == 'inward_circular') { |
|
106 |
+ p <- p + layout_inward_circular(xlim = xlim) |
|
103 | 107 |
} else if (layout == "fan") { |
104 | 108 |
p <- p + layout_fan(open.angle) |
105 | 109 |
} else if (layout %in% c("daylight", "equal_angle", "ape")) { |
... | ... |
@@ -104,6 +104,12 @@ ggtree <- function(tr, |
104 | 104 |
p <- p + layout_fan(open.angle) |
105 | 105 |
} else if (layout %in% c("daylight", "equal_angle", "ape")) { |
106 | 106 |
p <- p + ggplot2::coord_fixed() |
107 |
+ d <- p$data |
|
108 |
+ pn <- d[d$parent, ] |
|
109 |
+ dy <- pn$y - d$y |
|
110 |
+ dx <- pn$x - d$x |
|
111 |
+ angle <- atan2(dy, dx) * 180 / pi + 180 |
|
112 |
+ p$data$angle <- angle |
|
107 | 113 |
} else if (yscale == "none") { |
108 | 114 |
p <- p + |
109 | 115 |
scale_y_continuous(expand = expansion(0, 0.6)) |
... | ... |
@@ -106,7 +106,7 @@ ggtree <- function(tr, |
106 | 106 |
p <- p + ggplot2::coord_fixed() |
107 | 107 |
} else if (yscale == "none") { |
108 | 108 |
p <- p + |
109 |
- scale_y_continuous(expand = expand_scale(0, 0.6)) |
|
109 |
+ scale_y_continuous(expand = expansion(0, 0.6)) |
|
110 | 110 |
} |
111 | 111 |
|
112 | 112 |
class(p) <- c("ggtree", class(p)) |
... | ... |
@@ -104,7 +104,7 @@ ggtree <- function(tr, |
104 | 104 |
p <- p + layout_fan(open.angle) |
105 | 105 |
} else if (layout %in% c("daylight", "equal_angle", "ape")) { |
106 | 106 |
p <- p + ggplot2::coord_fixed() |
107 |
- } else { |
|
107 |
+ } else if (yscale == "none") { |
|
108 | 108 |
p <- p + |
109 | 109 |
scale_y_continuous(expand = expand_scale(0, 0.6)) |
110 | 110 |
} |
... | ... |
@@ -55,7 +55,8 @@ ggtree <- function(tr, |
55 | 55 |
|
56 | 56 |
# Check if layout string is valid. |
57 | 57 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", |
58 |
- "radial", "unrooted", "equal_angle", "daylight")) |
|
58 |
+ "radial", "unrooted", "equal_angle", "daylight", |
|
59 |
+ "ape")) |
|
59 | 60 |
|
60 | 61 |
if (layout == "unrooted") { |
61 | 62 |
layout <- "daylight" |
... | ... |
@@ -101,7 +102,7 @@ ggtree <- function(tr, |
101 | 102 |
p <- p + layout_circular() |
102 | 103 |
} else if (layout == "fan") { |
103 | 104 |
p <- p + layout_fan(open.angle) |
104 |
- } else if (layout %in% c("daylight", "equal_angle")) { |
|
105 |
+ } else if (layout %in% c("daylight", "equal_angle", "ape")) { |
|
105 | 106 |
p <- p + ggplot2::coord_fixed() |
106 | 107 |
} else { |
107 | 108 |
p <- p + |
... | ... |
@@ -101,6 +101,8 @@ ggtree <- function(tr, |
101 | 101 |
p <- p + layout_circular() |
102 | 102 |
} else if (layout == "fan") { |
103 | 103 |
p <- p + layout_fan(open.angle) |
104 |
+ } else if (layout %in% c("daylight", "equal_angle")) { |
|
105 |
+ p <- p + ggplot2::coord_fixed() |
|
104 | 106 |
} else { |
105 | 107 |
p <- p + |
106 | 108 |
scale_y_continuous(expand = expand_scale(0, 0.6)) |
... | ... |
@@ -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)) |
... | ... |
@@ -9,10 +9,10 @@ |
9 | 9 |
##' @param as.Date logical whether using Date class in time tree |
10 | 10 |
##' @param yscale y scale |
11 | 11 |
##' @param yscale_mapping yscale mapping for category variable |
12 |
-##' @param ladderize logical (default \code{TRUE}). Should the tree be re-organized to have a 'ladder' |
|
12 |
+##' @param ladderize logical (default `TRUE`). Should the tree be re-organized to have a 'ladder' |
|
13 | 13 |
##' aspect? |
14 |
-##' @param right logical. If \code{ladderize = TRUE}, should the ladder have the smallest clade on the |
|
15 |
-##' right-hand side? See \code{\link[ape]{ladderize}} for more information. |
|
14 |
+##' @param right logical. If `ladderize = TRUE`, should the ladder have the smallest clade on the |
|
15 |
+##' right-hand side? See [ape::ladderize()] for more information. |
|
16 | 16 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
17 | 17 |
##' @param root.position position of the root node (default = 0) |
18 | 18 |
##' @return tree |
... | ... |
@@ -26,7 +26,7 @@ |
26 | 26 |
##' @importFrom ggplot2 coord_polar |
27 | 27 |
##' @export |
28 | 28 |
##' @author Yu Guangchuang |
29 |
-##' @seealso \code{\link[ape]{ladderize}} |
|
29 |
+##' @seealso [ape::ladderize()] |
|
30 | 30 |
##' @examples |
31 | 31 |
##' require(ape) |
32 | 32 |
##' tr <- rtree(10) |
... | ... |
@@ -87,13 +87,11 @@ ggtree <- function(tr, |
87 | 87 |
p <- p + geom_tree(layout=layout, multiPhylo=multiPhylo, ...) |
88 | 88 |
|
89 | 89 |
|
90 |
- p <- p + theme_tree() |
|
90 |
+ p <- p + theme_tree() + |
|
91 |
+ scale_y_continuous(expand = expand_scale(0, 0.6)) |
|
91 | 92 |
|
92 | 93 |
if (layout == "circular" || layout == "radial") { |
93 | 94 |
p <- p + layout_circular() |
94 |
- ## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
|
95 |
- ## and also have some space for tree scale (legend) |
|
96 |
- p <- p + ylim(0, NA) |
|
97 | 95 |
} else if (layout == "fan") { |
98 | 96 |
p <- p + layout_fan(open.angle) |
99 | 97 |
} |
... | ... |
@@ -46,7 +46,9 @@ ggtree <- function(tr, |
46 | 46 |
...) { |
47 | 47 |
|
48 | 48 |
# Check if layout string is valid. |
49 |
- layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted", "equal_angle", "daylight")) |
|
49 |
+ layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", |
|
50 |
+ "radial", "unrooted", "equal_angle", "daylight")) |
|
51 |
+ |
|
50 | 52 |
if (layout == "unrooted") { |
51 | 53 |
layout <- "daylight" |
52 | 54 |
message('"daylight" method was used as default layout for unrooted tree.') |
... | ... |
@@ -88,12 +88,12 @@ ggtree <- function(tr, |
88 | 88 |
p <- p + theme_tree() |
89 | 89 |
|
90 | 90 |
if (layout == "circular" || layout == "radial") { |
91 |
- p <- layout_circular(p) |
|
91 |
+ p <- p + layout_circular() |
|
92 | 92 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
93 | 93 |
## and also have some space for tree scale (legend) |
94 | 94 |
p <- p + ylim(0, NA) |
95 | 95 |
} else if (layout == "fan") { |
96 |
- p <- layout_fan(p, open.angle) |
|
96 |
+ p <- p + layout_fan(open.angle) |
|
97 | 97 |
} |
98 | 98 |
|
99 | 99 |
class(p) <- c("ggtree", class(p)) |
... | ... |
@@ -14,6 +14,7 @@ |
14 | 14 |
##' @param right logical. If \code{ladderize = TRUE}, should the ladder have the smallest clade on the |
15 | 15 |
##' right-hand side? See \code{\link[ape]{ladderize}} for more information. |
16 | 16 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
17 |
+##' @param root.position position of the root node (default = 0) |
|
17 | 18 |
##' @return tree |
18 | 19 |
##' @importFrom ggplot2 ggplot |
19 | 20 |
##' @importFrom ggplot2 xlab |
... | ... |
@@ -41,6 +42,7 @@ ggtree <- function(tr, |
41 | 42 |
ladderize = TRUE, |
42 | 43 |
right = FALSE, |
43 | 44 |
branch.length = "branch.length", |
45 |
+ root.position = 0, |
|
44 | 46 |
...) { |
45 | 47 |
|
46 | 48 |
# Check if layout string is valid. |
... | ... |
@@ -71,6 +73,7 @@ ggtree <- function(tr, |
71 | 73 |
ladderize = ladderize, |
72 | 74 |
right = right, |
73 | 75 |
branch.length = branch.length, |
76 |
+ root.position = root.position, |
|
74 | 77 |
...) |
75 | 78 |
|
76 | 79 |
if (is(tr, "multiPhylo")) { |
... | ... |
@@ -4,6 +4,7 @@ |
4 | 4 |
##' @title ggtree |
5 | 5 |
##' @inheritParams geom_tree |
6 | 6 |
##' @param tr phylo object |
7 |
+##' @param open.angle open angle, only for 'fan' layout |
|
7 | 8 |
##' @param mrsd most recent sampling date |
8 | 9 |
##' @param as.Date logical whether using Date class in time tree |
9 | 10 |
##' @param yscale y scale |
... | ... |
@@ -2,10 +2,8 @@ |
2 | 2 |
##' |
3 | 3 |
##' |
4 | 4 |
##' @title ggtree |
5 |
+##' @inheritParams geom_tree |
|
5 | 6 |
##' @param tr phylo object |
6 |
-##' @param mapping aes mapping |
|
7 |
-##' @param layout one of 'rectangular', 'slanted', 'fan', 'circular', 'radial', 'equal_angle' or 'daylight' |
|
8 |
-##' @param open.angle open angle, only for 'fan' layout |
|
9 | 7 |
##' @param mrsd most recent sampling date |
10 | 8 |
##' @param as.Date logical whether using Date class in time tree |
11 | 9 |
##' @param yscale y scale |
... | ... |
@@ -15,7 +13,6 @@ |
15 | 13 |
##' @param right logical. If \code{ladderize = TRUE}, should the ladder have the smallest clade on the |
16 | 14 |
##' right-hand side? See \code{\link[ape]{ladderize}} for more information. |
17 | 15 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
18 |
-##' @param ... additional parameter |
|
19 | 16 |
##' @return tree |
20 | 17 |
##' @importFrom ggplot2 ggplot |
21 | 18 |
##' @importFrom ggplot2 xlab |
... | ... |
@@ -10,8 +10,10 @@ |
10 | 10 |
##' @param as.Date logical whether using Date class in time tree |
11 | 11 |
##' @param yscale y scale |
12 | 12 |
##' @param yscale_mapping yscale mapping for category variable |
13 |
-##' @param ladderize logical |
|
14 |
-##' @param right logical |
|
13 |
+##' @param ladderize logical (default \code{TRUE}). Should the tree be re-organized to have a 'ladder' |
|
14 |
+##' aspect? |
|
15 |
+##' @param right logical. If \code{ladderize = TRUE}, should the ladder have the smallest clade on the |
|
16 |
+##' right-hand side? See \code{\link[ape]{ladderize}} for more information. |
|
15 | 17 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
16 | 18 |
##' @param ... additional parameter |
17 | 19 |
##' @return tree |
... | ... |
@@ -25,6 +27,7 @@ |
25 | 27 |
##' @importFrom ggplot2 coord_polar |
26 | 28 |
##' @export |
27 | 29 |
##' @author Yu Guangchuang |
30 |
+##' @seealso \code{\link[ape]{ladderize}} |
|
28 | 31 |
##' @examples |
29 | 32 |
##' require(ape) |
30 | 33 |
##' tr <- rtree(10) |
... | ... |
@@ -49,10 +49,6 @@ ggtree <- function(tr, |
49 | 49 |
message('"daylight" method was used as default layout for unrooted tree.') |
50 | 50 |
} |
51 | 51 |
|
52 |
- if (is(tr, "r8s") && branch.length == "branch.length") { |
|
53 |
- branch.length = "TREE" |
|
54 |
- } |
|
55 |
- |
|
56 | 52 |
if(yscale != "none") { |
57 | 53 |
## for 2d tree |
58 | 54 |
layout <- "slanted" |
... | ... |
@@ -13,7 +13,6 @@ |
13 | 13 |
##' @param ladderize logical |
14 | 14 |
##' @param right logical |
15 | 15 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
16 |
-##' @param ndigits number of digits to round numerical annotation variable |
|
17 | 16 |
##' @param ... additional parameter |
18 | 17 |
##' @return tree |
19 | 18 |
##' @importFrom ggplot2 ggplot |
... | ... |
@@ -41,7 +40,6 @@ ggtree <- function(tr, |
41 | 40 |
ladderize = TRUE, |
42 | 41 |
right = FALSE, |
43 | 42 |
branch.length = "branch.length", |
44 |
- ndigits = NULL, |
|
45 | 43 |
...) { |
46 | 44 |
|
47 | 45 |
# Check if layout string is valid. |
... | ... |
@@ -76,7 +74,7 @@ ggtree <- function(tr, |
76 | 74 |
ladderize = ladderize, |
77 | 75 |
right = right, |
78 | 76 |
branch.length = branch.length, |
79 |
- ndigits = ndigits, ...) |
|
77 |
+ ...) |
|
80 | 78 |
|
81 | 79 |
if (is(tr, "multiPhylo")) { |
82 | 80 |
multiPhylo <- TRUE |
... | ... |
@@ -4,8 +4,7 @@ |
4 | 4 |
##' @title ggtree |
5 | 5 |
##' @param tr phylo object |
6 | 6 |
##' @param mapping aes mapping |
7 |
-##' @param layout one of 'rectangular', 'slanted', 'fan', 'circular', 'radial' or 'unrooted' |
|
8 |
-##' @param layout.method of 'equal_angle', 'daylight'. |
|
7 |
+##' @param layout one of 'rectangular', 'slanted', 'fan', 'circular', 'radial', 'equal_angle' or 'daylight' |
|
9 | 8 |
##' @param open.angle open angle, only for 'fan' layout |
10 | 9 |
##' @param mrsd most recent sampling date |
11 | 10 |
##' @param as.Date logical whether using Date class in time tree |
... | ... |
@@ -34,7 +33,6 @@ |
34 | 33 |
ggtree <- function(tr, |
35 | 34 |
mapping = NULL, |
36 | 35 |
layout = "rectangular", |
37 |
- layout.method = "equal_angle", |
|
38 | 36 |
open.angle = 0, |
39 | 37 |
mrsd = NULL, |
40 | 38 |
as.Date = FALSE, |
... | ... |
@@ -47,9 +45,12 @@ ggtree <- function(tr, |
47 | 45 |
...) { |
48 | 46 |
|
49 | 47 |
# Check if layout string is valid. |
50 |
- layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted")) |
|
51 |
- layout.method %<>% match.arg(c("equal_angle", "daylight")) |
|
52 |
- |
|
48 |
+ layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted", "equal_angle", "daylight")) |
|
49 |
+ if (layout == "unrooted") { |
|
50 |
+ layout <- "daylight" |
|
51 |
+ message('"daylight" method was used as default layout for unrooted tree.') |
|
52 |
+ } |
|
53 |
+ |
|
53 | 54 |
if (is(tr, "r8s") && branch.length == "branch.length") { |
54 | 55 |
branch.length = "TREE" |
55 | 56 |
} |
... | ... |
@@ -64,11 +65,10 @@ ggtree <- function(tr, |
64 | 65 |
} else { |
65 | 66 |
mapping <- modifyList(aes_(~x, ~y), mapping) |
66 | 67 |
} |
67 |
- |
|
68 |
- p <- ggplot(tr, |
|
68 |
+ |
|
69 |
+ p <- ggplot(tr, |
|
69 | 70 |
mapping = mapping, |
70 | 71 |
layout = layout, |
71 |
- layout.method = layout.method, |
|
72 | 72 |
mrsd = mrsd, |
73 | 73 |
as.Date = as.Date, |
74 | 74 |
yscale = yscale, |
... | ... |
@@ -5,6 +5,7 @@ |
5 | 5 |
##' @param tr phylo object |
6 | 6 |
##' @param mapping aes mapping |
7 | 7 |
##' @param layout one of 'rectangular', 'slanted', 'fan', 'circular', 'radial' or 'unrooted' |
8 |
+##' @param layout.method of 'equal_angle', 'daylight'. |
|
8 | 9 |
##' @param open.angle open angle, only for 'fan' layout |
9 | 10 |
##' @param mrsd most recent sampling date |
10 | 11 |
##' @param as.Date logical whether using Date class in time tree |
... | ... |
@@ -33,6 +34,7 @@ |
33 | 34 |
ggtree <- function(tr, |
34 | 35 |
mapping = NULL, |
35 | 36 |
layout = "rectangular", |
37 |
+ layout.method = "equal_angle", |
|
36 | 38 |
open.angle = 0, |
37 | 39 |
mrsd = NULL, |
38 | 40 |
as.Date = FALSE, |
... | ... |
@@ -44,8 +46,10 @@ ggtree <- function(tr, |
44 | 46 |
ndigits = NULL, |
45 | 47 |
...) { |
46 | 48 |
|
49 |
+ # Check if layout string is valid. |
|
47 | 50 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted")) |
48 |
- |
|
51 |
+ layout.method %<>% match.arg(c("equal_angle", "daylight")) |
|
52 |
+ |
|
49 | 53 |
if (is(tr, "r8s") && branch.length == "branch.length") { |
50 | 54 |
branch.length = "TREE" |
51 | 55 |
} |
... | ... |
@@ -60,8 +64,11 @@ ggtree <- function(tr, |
60 | 64 |
} else { |
61 | 65 |
mapping <- modifyList(aes_(~x, ~y), mapping) |
62 | 66 |
} |
63 |
- p <- ggplot(tr, mapping=mapping, |
|
67 |
+ |
|
68 |
+ p <- ggplot(tr, |
|
69 |
+ mapping = mapping, |
|
64 | 70 |
layout = layout, |
71 |
+ layout.method = layout.method, |
|
65 | 72 |
mrsd = mrsd, |
66 | 73 |
as.Date = as.Date, |
67 | 74 |
yscale = yscale, |
... | ... |
@@ -95,14 +95,3 @@ ggtree <- function(tr, |
95 | 95 |
|
96 | 96 |
return(p) |
97 | 97 |
} |
98 |
- |
|
99 |
-##' test whether input object is produced by ggtree function |
|
100 |
-##' |
|
101 |
-##' |
|
102 |
-##' @title is.ggtree |
|
103 |
-##' @param x object |
|
104 |
-##' @return TRUE or FALSE |
|
105 |
-##' @export |
|
106 |
-##' @author guangchuang yu |
|
107 |
-is.ggtree <- function(x) inherits(x, 'ggtree') |
|
108 |
- |
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
##' drawing phylogenetic tree from phylo object |
2 | 2 |
##' |
3 |
-##' |
|
3 |
+##' |
|
4 | 4 |
##' @title ggtree |
5 | 5 |
##' @param tr phylo object |
6 | 6 |
##' @param mapping aes mapping |
... | ... |
@@ -43,13 +43,13 @@ ggtree <- function(tr, |
43 | 43 |
branch.length = "branch.length", |
44 | 44 |
ndigits = NULL, |
45 | 45 |
...) { |
46 |
- |
|
46 |
+ |
|
47 | 47 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted")) |
48 | 48 |
|
49 | 49 |
if (is(tr, "r8s") && branch.length == "branch.length") { |
50 | 50 |
branch.length = "TREE" |
51 | 51 |
} |
52 |
- |
|
52 |
+ |
|
53 | 53 |
if(yscale != "none") { |
54 | 54 |
## for 2d tree |
55 | 55 |
layout <- "slanted" |
... | ... |
@@ -76,20 +76,33 @@ ggtree <- function(tr, |
76 | 76 |
} else { |
77 | 77 |
multiPhylo <- FALSE |
78 | 78 |
} |
79 |
- |
|
79 |
+ |
|
80 | 80 |
p <- p + geom_tree(layout=layout, multiPhylo=multiPhylo, ...) |
81 | 81 |
|
82 | 82 |
|
83 | 83 |
p <- p + theme_tree() |
84 |
- |
|
84 |
+ |
|
85 | 85 |
if (layout == "circular" || layout == "radial") { |
86 | 86 |
p <- layout_circular(p) |
87 | 87 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
88 | 88 |
## and also have some space for tree scale (legend) |
89 |
- p <- p + ylim(0, NA) |
|
89 |
+ p <- p + ylim(0, NA) |
|
90 | 90 |
} else if (layout == "fan") { |
91 | 91 |
p <- layout_fan(p, open.angle) |
92 | 92 |
} |
93 | 93 |
|
94 |
+ class(p) <- c("ggtree", class(p)) |
|
95 |
+ |
|
94 | 96 |
return(p) |
95 | 97 |
} |
98 |
+ |
|
99 |
+##' test whether input object is produced by ggtree function |
|
100 |
+##' |
|
101 |
+##' |
|
102 |
+##' @title is.ggtree |
|
103 |
+##' @param x object |
|
104 |
+##' @return TRUE or FALSE |
|
105 |
+##' @export |
|
106 |
+##' @author guangchuang yu |
|
107 |
+is.ggtree <- function(x) inherits(x, 'ggtree') |
|
108 |
+ |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@122021 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -21,7 +21,7 @@ |
21 | 21 |
##' @importFrom ggplot2 ylab |
22 | 22 |
##' @importFrom ggplot2 annotate |
23 | 23 |
##' @importFrom ggplot2 scale_x_reverse |
24 |
-##' @importFrom ggplot2 scale_y_continuous |
|
24 |
+##' @importFrom ggplot2 ylim |
|
25 | 25 |
##' @importFrom ggplot2 coord_flip |
26 | 26 |
##' @importFrom ggplot2 coord_polar |
27 | 27 |
##' @export |
... | ... |
@@ -86,7 +86,7 @@ ggtree <- function(tr, |
86 | 86 |
p <- layout_circular(p) |
87 | 87 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
88 | 88 |
## and also have some space for tree scale (legend) |
89 |
- p <- p + scale_y_continuous(limits=c(0, max(p$data$y)+1)) |
|
89 |
+ p <- p + ylim(0, NA) |
|
90 | 90 |
} else if (layout == "fan") { |
91 | 91 |
p <- layout_fan(p, open.angle) |
92 | 92 |
} |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@118985 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -43,7 +43,7 @@ ggtree <- function(tr, |
43 | 43 |
branch.length = "branch.length", |
44 | 44 |
ndigits = NULL, |
45 | 45 |
...) { |
46 |
- |
|
46 |
+ |
|
47 | 47 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted")) |
48 | 48 |
|
49 | 49 |
if (is(tr, "r8s") && branch.length == "branch.length") { |
... | ... |
@@ -90,6 +90,6 @@ ggtree <- function(tr, |
90 | 90 |
} else if (layout == "fan") { |
91 | 91 |
p <- layout_fan(p, open.angle) |
92 | 92 |
} |
93 |
- |
|
93 |
+ |
|
94 | 94 |
return(p) |
95 | 95 |
} |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@117331 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -4,7 +4,8 @@ |
4 | 4 |
##' @title ggtree |
5 | 5 |
##' @param tr phylo object |
6 | 6 |
##' @param mapping aes mapping |
7 |
-##' @param layout one of 'rectangular', 'slanted', 'fan'/'circular', 'radial' or 'unrooted' |
|
7 |
+##' @param layout one of 'rectangular', 'slanted', 'fan', 'circular', 'radial' or 'unrooted' |
|
8 |
+##' @param open.angle open angle, only for 'fan' layout |
|
8 | 9 |
##' @param mrsd most recent sampling date |
9 | 10 |
##' @param as.Date logical whether using Date class in time tree |
10 | 11 |
##' @param yscale y scale |
... | ... |
@@ -32,6 +33,7 @@ |
32 | 33 |
ggtree <- function(tr, |
33 | 34 |
mapping = NULL, |
34 | 35 |
layout = "rectangular", |
36 |
+ open.angle = 0, |
|
35 | 37 |
mrsd = NULL, |
36 | 38 |
as.Date = FALSE, |
37 | 39 |
yscale = "none", |
... | ... |
@@ -52,15 +54,7 @@ ggtree <- function(tr, |
52 | 54 |
## for 2d tree |
53 | 55 |
layout <- "slanted" |
54 | 56 |
} |
55 |
- if (layout == "fan" || layout == "circular") { |
|
56 |
- layout <- "circular" |
|
57 |
- type <- "circular" |
|
58 |
- } else if (layout == "radial") { |
|
59 |
- layout <- "slanted" |
|
60 |
- type <- "radial" |
|
61 |
- } else { |
|
62 |
- type <- "none" |
|
63 |
- } |
|
57 |
+ |
|
64 | 58 |
if (is.null(mapping)) { |
65 | 59 |
mapping <- aes_(~x, ~y) |
66 | 60 |
} else { |
... | ... |
@@ -88,12 +82,14 @@ ggtree <- function(tr, |
88 | 82 |
|
89 | 83 |
p <- p + theme_tree() |
90 | 84 |
|
91 |
- if (type == "circular" || type == "radial") { |
|
92 |
- p <- p + coord_polar(theta = "y") |
|
85 |
+ if (layout == "circular" || layout == "radial") { |
|
86 |
+ p <- layout_circular(p) |
|
93 | 87 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
94 | 88 |
## and also have some space for tree scale (legend) |
95 | 89 |
p <- p + scale_y_continuous(limits=c(0, max(p$data$y)+1)) |
96 |
- } |
|
97 |
- |
|
90 |
+ } else if (layout == "fan") { |
|
91 |
+ p <- layout_fan(p, open.angle) |
|
92 |
+ } |
|
93 |
+ |
|
98 | 94 |
return(p) |
99 | 95 |
} |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@117270 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -92,7 +92,7 @@ ggtree <- function(tr, |
92 | 92 |
p <- p + coord_polar(theta = "y") |
93 | 93 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
94 | 94 |
## and also have some space for tree scale (legend) |
95 |
- p <- p + scale_y_continuous(limits=c(0, max(p$data$y))) |
|
95 |
+ p <- p + scale_y_continuous(limits=c(0, max(p$data$y)+1)) |
|
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
return(p) |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@115874 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -94,16 +94,6 @@ ggtree <- function(tr, |
94 | 94 |
## and also have some space for tree scale (legend) |
95 | 95 |
p <- p + scale_y_continuous(limits=c(0, max(p$data$y))) |
96 | 96 |
} |
97 |
- |
|
98 |
- attr(p, "mrsd") <- mrsd |
|
99 |
- attr(p, "param") <- list(layout = layout, |
|
100 |
- yscale = yscale, |
|
101 |
- ladderize = ladderize, |
|
102 |
- right = right, |
|
103 |
- branch.length = branch.length, |
|
104 |
- ndigits = ndigits) |
|
97 |
+ |
|
105 | 98 |
return(p) |
106 | 99 |
} |
107 |
- |
|
108 |
- |
|
109 |
- |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@113679 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -76,8 +76,17 @@ ggtree <- function(tr, |
76 | 76 |
right = right, |
77 | 77 |
branch.length = branch.length, |
78 | 78 |
ndigits = ndigits, ...) |
79 |
+ |
|
80 |
+ if (is(tr, "multiPhylo")) { |
|
81 |
+ multiPhylo <- TRUE |
|
82 |
+ } else { |
|
83 |
+ multiPhylo <- FALSE |
|
84 |
+ } |
|
79 | 85 |
|
80 |
- p <- p + geom_tree(layout, ...) + theme_tree() |
|
86 |
+ p <- p + geom_tree(layout=layout, multiPhylo=multiPhylo, ...) |
|
87 |
+ |
|
88 |
+ |
|
89 |
+ p <- p + theme_tree() |
|
81 | 90 |
|
82 | 91 |
if (type == "circular" || type == "radial") { |
83 | 92 |
p <- p + coord_polar(theta = "y") |
... | ... |
@@ -96,123 +105,5 @@ ggtree <- function(tr, |
96 | 105 |
return(p) |
97 | 106 |
} |
98 | 107 |
|
99 |
-##' add tree layer |
|
100 |
-##' |
|
101 |
-##' |
|
102 |
-##' @title geom_tree |
|
103 |
-##' @param layout one of 'rectangular', 'slanted', 'circular', 'radial' or 'unrooted' |
|
104 |
-##' @param ... additional parameter |
|
105 |
-##' @return tree layer |
|
106 |
-##' @importFrom ggplot2 geom_segment |
|
107 |
-##' @importFrom ggplot2 aes |
|
108 |
-##' @export |
|
109 |
-##' @author Yu Guangchuang |
|
110 |
-##' @examples |
|
111 |
-##' require(ape) |
|
112 |
-##' tr <- rtree(10) |
|
113 |
-##' require(ggplot2) |
|
114 |
-##' ggplot(tr) + geom_tree() |
|
115 |
-geom_tree <- function(layout="rectangular", ...) { |
|
116 |
- x <- y <- parent <- NULL |
|
117 |
- lineend = "round" |
|
118 |
- if (layout == "rectangular" || layout == "fan" || layout == "circular") { |
|
119 |
- list( |
|
120 |
- geom_segment(aes(x = x[parent], |
|
121 |
- xend = x, |
|
122 |
- y = y, |
|
123 |
- yend = y), |
|
124 |
- lineend = lineend, ...), |
|
125 |
- |
|
126 |
- geom_segment(aes(x = x[parent], |
|
127 |
- xend = x[parent], |
|
128 |
- y = y[parent], |
|
129 |
- yend = y), |
|
130 |
- lineend = lineend, ...) |
|
131 |
- ) |
|
132 |
- } else if (layout == "slanted" || layout == "radial" || layout == "unrooted") { |
|
133 |
- geom_segment(aes(x = x[parent], |
|
134 |
- xend = x, |
|
135 |
- y = y[parent], |
|
136 |
- yend = y), |
|
137 |
- lineend = lineend, ...) |
|
138 |
- } |
|
139 |
-} |
|
140 |
- |
|
141 |
- |
|
142 |
- |
|
143 |
- |
|