... | ... |
@@ -1,5 +1,7 @@ |
1 | 1 |
CHANGES IN VERSION 1.9.2 |
2 | 2 |
------------------------ |
3 |
+ o scaleClade works after calling viewClade <2017-07-20, Thu> |
|
4 |
+ + https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/bioc-ggtree/QVSryszPaFY |
|
3 | 5 |
o gheatmap support handling collapsed tree <2017-06-29, Thu> |
4 | 6 |
+ https://github.com/GuangchuangYu/ggtree/issues/137 |
5 | 7 |
|
... | ... |
@@ -42,10 +42,18 @@ viewClade <- function(tree_view=NULL, node, xmax_adjust=0) { |
42 | 42 |
cpos <- get_clade_position(tree_view, node=node) |
43 | 43 |
xmax <- ggplot_build(tree_view)$layout$panel_ranges[[1]]$x.range[2] |
44 | 44 |
|
45 |
+ attr(tree_view, 'viewClade') <- TRUE |
|
46 |
+ attr(tree_view, 'viewClade_node') <- node |
|
47 |
+ |
|
45 | 48 |
## tree_view+xlim(cpos$xmin, xmax + xmax_adjust) + ylim(cpos$ymin, cpos$ymax) |
46 | 49 |
tree_view + coord_cartesian(xlim=c(cpos$xmin, xmax), ylim=c(cpos$ymin, cpos$ymax), expand=FALSE) |
47 | 50 |
} |
48 | 51 |
|
52 |
+is.viewClade <- function(tree_view) { |
|
53 |
+ x <- attr(tree_view, 'viewClade') |
|
54 |
+ !is.null(x) && x |
|
55 |
+} |
|
56 |
+ |
|
49 | 57 |
|
50 | 58 |
|
51 | 59 |
##' collapse a clade |
... | ... |
@@ -298,10 +306,18 @@ scaleClade <- function(tree_view=NULL, node, scale=1, vertical_only=TRUE) { |
298 | 306 |
df <- calculate_branch_mid(df) |
299 | 307 |
|
300 | 308 |
tree_view$data <- calculate_angle(df) |
309 |
+ |
|
310 |
+ |
|
311 |
+ if (is.viewClade(tree_view)) { |
|
312 |
+ vc_node <- attr(tree_view, 'viewClade_node') |
|
313 |
+ tree_view <- viewClade(tree_view, vc_node) |
|
314 |
+ } |
|
315 |
+ |
|
301 | 316 |
tree_view |
302 | 317 |
} |
303 | 318 |
|
304 | 319 |
|
320 |
+ |
|
305 | 321 |
reassign_y_from_node_to_root <- function(df, node) { |
306 | 322 |
root <- which(df$node == df$parent) |
307 | 323 |
pp <- df[node, "parent"] |
... | ... |
@@ -11,7 +11,7 @@ html_preview: false |
11 | 11 |
# ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
12 | 12 |
|
13 | 13 |
```{r echo=FALSE, results="hide", message=FALSE} |
14 |
-library("txtplot") |
|
14 |
+#library("txtplot") |
|
15 | 15 |
library("badger") |
16 | 16 |
library("ypages") |
17 | 17 |
library("ggplot2") |