Browse code

bug fixed

Guangchuang Yu authored on 26/01/2020 15:25:32
Showing 7 changed files

... ...
@@ -17,3 +17,5 @@ ggtree_sticker.R
17 17
 site_src
18 18
 ggtree.png
19 19
 ^CONDUCT\.md$
20
+CONTRIBUTORS.md
21
+CONTRIBUTING.md
... ...
@@ -1,6 +1,7 @@
1 1
 # Bradley Jones
2 2
 
3
-
3
++ ape unrooted layout
4
+  - <https://github.com/YuLab-SMU/ggtree/issues/272>
4 5
 + `ggdensitree` function
5 6
   - <https://github.com/YuLab-SMU/ggtree/pull/253>
6 7
 + made data usable with treedata in 'equal_angle' and 'daylight' layouts 
... ...
@@ -1,7 +1,7 @@
1 1
 Package: ggtree
2 2
 Type: Package
3 3
 Title: an R package for visualization of tree and annotation data
4
-Version: 2.1.1
4
+Version: 2.1.2
5 5
 Authors@R: c(
6 6
 	   person("Guangchuang", "Yu",     email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6485-8781")),
7 7
 	   person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com",   role = c("aut", "ths")),
... ...
@@ -1,3 +1,11 @@
1
+# ggtree 2.1.2
2
+
3
++ bug fixed of determined layout for `ggplot(tree) + geom_tiplab()` (2020-01-26, Sun)
4
+  - <https://github.com/YuLab-SMU/ggtree/issues/272>
5
++ set unrooted layout to use `coord_fixed` by default (2020-01-25, Sat)
6
++ if `layout = "ape"`, use ape unrooted layout 
7
+  - <https://github.com/YuLab-SMU/ggtree/issues/272>
8
+
1 9
 # ggtree 2.1.1
2 10
 
3 11
 + export `geom_highlight` as an alias of `geom_hilight` (2020-01-08, Wed)
... ...
@@ -63,6 +63,7 @@ fortify.phylo <- function(model, data,
63 63
     }
64 64
     res <- scaleY(as.phylo(model), res, yscale, layout, ...)
65 65
     class(res) <- c("tbl_tree", class(res))
66
+    attr(res, "layout") <- layout
66 67
     return(res)
67 68
 }
68 69
 
... ...
@@ -84,6 +85,7 @@ fortify.multiPhylo <-  function(model, data,
84 85
     df <- do.call("rbind", df.list)
85 86
     df$.id <- rep(names(df.list), times=sapply(df.list, nrow))
86 87
     df$.id <- factor(df$.id, levels=names(df.list))
88
+    attr(df, "layout") <- layout
87 89
     return(df)
88 90
 }
89 91
 
... ...
@@ -155,6 +155,9 @@ ggplot_add.facet_plot <- function(object, plot, object_name) {
155 155
 ##' @export
156 156
 ggplot_add.tiplab <- function(object, plot, object_name) {
157 157
     layout <- get("layout", envir = plot$plot_env)
158
+    if (!is(layout, "character")) {
159
+        layout <- attr(plot$data, "layout")
160
+    }
158 161
     if (layout == 'circular' || layout == 'fan') {
159 162
         ly <- do.call(geom_tiplab_circular, object)
160 163
     } else {
... ...
@@ -1189,8 +1189,9 @@ re_assign_ycoord_df <- function(df, currentNode) {
1189 1189
     return(df)
1190 1190
 }
1191 1191
 
1192
+
1192 1193
 layoutApe <- function(model, branch.length="branch.length") {
1193
-	tree <- as.phylo(model) %>% reorder("postorder")
1194
+	tree <- as.phylo(model) %>% stats::reorder("postorder")
1194 1195
 	
1195 1196
 	if (! is.null(tree$edge.length)) {
1196 1197
 		if (anyNA(tree$edge.length)) {