Browse code

fixed geom_range to support height_0.95_HPD <2017-03-03, Fri>

guangchuang yu authored on 03/03/2017 05:42:32
Showing 4 changed files

... ...
@@ -10,3 +10,4 @@ README.Rmd
10 10
 mkdocs
11 11
 docs
12 12
 logo.png.github
13
+.github
... ...
@@ -1,5 +1,6 @@
1 1
 CHANGES IN VERSION 1.7.9
2 2
 ------------------------
3
+ o fixed geom_range to support height_0.95_HPD <2017-03-03, Fri>
3 4
  o fixed geom_tiplab(geom='label') <2017-03-02, Thu>
4 5
    + https://github.com/GuangchuangYu/ggtree/issues/115
5 6
 
... ...
@@ -16,7 +16,11 @@ geom_range <- function(range="height_0.95_HPD", ...) {
16 16
 
17 17
     default_aes <- aes_(x=~x, y=~y, xend=~x, yend=~y)
18 18
 
19
-    mapping <- modifyList(default_aes, aes_string(branch.length="branch.length", label=range))
19
+    if (grepl("^height", range)) {
20
+        mapping <- modifyList(default_aes, aes_string(branch.length="height", label=range))
21
+    } else {
22
+        mapping <- modifyList(default_aes, aes_string(branch.length="branch.length", label=range))
23
+    }
20 24
 
21 25
     layer(
22 26
         stat = StatRange,
... ...
@@ -26,7 +30,8 @@ geom_range <- function(range="height_0.95_HPD", ...) {
26 30
         position = position,
27 31
         show.legend=show.legend,
28 32
         inherit.aes = inherit.aes,
29
-        params = list(na.rm = na.rm, ...),
33
+        params = list(na.rm = na.rm,
34
+                      ...),
30 35
         check.aes = FALSE
31 36
     )
32 37
 
... ...
@@ -42,6 +47,7 @@ StatRange <- ggproto("StatRange", Stat,
42 47
                          rr2 <- strsplit(rr, split=',') %>% do.call('rbind', .)
43 48
                          rr2 <- matrix(as.numeric(rr2), ncol=2, byrow=FALSE)
44 49
                          rr2 <- rr2 + df$x - df$branch
50
+
45 51
                          data.frame(x = rr2[,1],
46 52
                                     xend = rr2[,2],
47 53
                                     y = df$y,
... ...
@@ -4,7 +4,7 @@ ggtree: an R package for visualization and annotation of phylogenetic trees with
4 4
 
5 5
 [![releaseVersion](https://img.shields.io/badge/release%20version-1.6.9-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![develVersion](https://img.shields.io/badge/devel%20version-1.7.9-green.svg?style=flat)](https://github.com/GuangchuangYu/ggtree) [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [![total](https://img.shields.io/badge/downloads-22704/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1894/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) <img src="logo.png" align="right" />
6 6
 
7
-[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/GuangchuangYu/ggtree/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ggtree) [![Last-changedate](https://img.shields.io/badge/last%20change-2017--03--02-green.svg)](https://github.com/GuangchuangYu/ggtree/commits/master) [![GitHub forks](https://img.shields.io/github/forks/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/network) [![GitHub stars](https://img.shields.io/github/stars/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/stargazers) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome-r.com/#awesome-r-graphic-displays)
7
+[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/GuangchuangYu/ggtree/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ggtree) [![Last-changedate](https://img.shields.io/badge/last%20change-2017--03--03-green.svg)](https://github.com/GuangchuangYu/ggtree/commits/master) [![GitHub forks](https://img.shields.io/github/forks/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/network) [![GitHub stars](https://img.shields.io/github/stars/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/stargazers) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome-r.com/#awesome-r-graphic-displays)
8 8
 
9 9
 [![platform](http://www.bioconductor.org/shields/availability/devel/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [![Build Status](http://www.bioconductor.org/shields/build/devel/bioc/ggtree.svg)](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [![Linux/Mac Travis Build Status](https://img.shields.io/travis/GuangchuangYu/ggtree/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/GuangchuangYu/ggtree) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/Guangchuangyu/ggtree/master.svg?label=Windows)](https://ci.appveyor.com/project/GuangchuangYu/ggtree) [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-green.svg?style=flat)](http://bioconda.github.io/recipes/bioconductor-ggtree/README.html)
10 10