Browse code

subset supports logical vector contains NA, and geom_cladelabel supports parsing emoji

guangchuang yu authored on 16/02/2017 06:10:17
Showing 7 changed files

... ...
@@ -1,9 +1,11 @@
1 1
 CHANGES IN VERSION 1.7.7
2 2
 ------------------------
3
+ o geom_cladelabel support parse="emoji" <2017-02-16, Thu>
4
+ o aes(subset) now support logical vector contains NA <2017-02-16, Thu>
3 5
  o add legend transparency to theme_transparent <2017-02-13, Mon>
4 6
    + <https://github.com/GuangchuangYu/ggtree/pull/112>
5 7
  o update citation info <2017-01-20, Fri>
6
- 
8
+
7 9
 CHANGES IN VERSION 1.7.6
8 10
 ------------------------
9 11
  o inset support reverse scale <2017-01-05, Thu>
... ...
@@ -47,6 +47,13 @@ geom_cladelabel <- function(node, label, offset=0, offset.text=0,
47 47
         }
48 48
     }
49 49
 
50
+    if (parse == 'emoji') {
51
+        emoji <- get_fun_from_pkg("emojifont", "emoji")
52
+        label <- emoji(label)
53
+        parse <- FALSE
54
+        family <- "OpenSansEmoji"
55
+    }
56
+
50 57
     if (is.null(color)) {
51 58
         if (geom == "text") {
52 59
             ## no fill parameter
... ...
@@ -78,7 +78,7 @@ GeomLabelGGtree <- ggproto("GeomLabelGGtree", GeomLabel,
78 78
                            setup_data = function(data, params) {
79 79
                                if (is.null(data$subset))
80 80
                                    return(data)
81
-                               data[data$subset,]
81
+                               data[which(data$subset),]
82 82
                            },
83 83
                            draw_panel = function(self, data, panel_scales, coord, parse = FALSE,
84 84
                                                  na.rm = FALSE,
... ...
@@ -137,7 +137,7 @@ GeomPointGGtree <- ggproto("GeomPointGGtree", GeomPoint,
137 137
                            setup_data = function(data, params) {
138 138
                                if (is.null(data$subset))
139 139
                                    return(data)
140
-                               data[data$subset,]
140
+                               data[which(data$subset),]
141 141
                            }
142 142
 
143 143
                            ## ,
... ...
@@ -78,7 +78,7 @@ GeomSegmentGGtree <- ggproto("GeomSegmentGGtree", GeomSegment,
78 78
                              setup_data = function(data, params) {
79 79
                                  if (is.null(data$subset))
80 80
                                      return(data)
81
-                                 data[data$subset,]
81
+                                 data[which(data$subset),]
82 82
                              },
83 83
 
84 84
                              draw_panel = function(data, panel_scales, coord, arrow = NULL,
... ...
@@ -66,7 +66,7 @@ GeomTextGGtree <- ggproto("GeomTextGGtree", GeomText,
66 66
                           setup_data = function(data, params) {
67 67
                               if (is.null(data$subset))
68 68
                                   return(data)
69
-                              data[data$subset,]
69
+                              data[which(data$subset),] ## use `which` makes it compatible with NA
70 70
                           },
71 71
                           ## compute_group = function(data, params) {
72 72
                           ##     data
... ...
@@ -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.7-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-21822/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--02--15-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--02--16-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
 
... ...
@@ -18,7 +18,7 @@ Please cite the following article when using `ggtree`:
18 18
 
19 19
 **G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ***Methods in Ecology and Evolution***. 2017, 8(1):28-36.
20 20
 
21
-[![doi](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![citation](https://img.shields.io/badge/cited%20by-7-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627) [![Altmetric](https://img.shields.io/badge/Altmetric-345-green.svg?style=flat)](https://www.altmetric.com/details/10533079)
21
+[![doi](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![citation](https://img.shields.io/badge/cited%20by-7-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627) [![Altmetric](https://img.shields.io/badge/Altmetric-351-green.svg?style=flat)](https://www.altmetric.com/details/10533079)
22 22
 
23 23
 ------------------------------------------------------------------------
24 24