Browse code

update geom_strip

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@119677 bc3139a8-67e5-0310-9ffc-ced21a209358

g.yu authored on 27/07/2016 05:17:32
Showing 2 changed files

... ...
@@ -1,6 +1,7 @@
1 1
 CHANGES IN VERSION 1.5.7
2 2
 ------------------------
3
- o geom_strip now only accept node id as input and support labeling strip <2016-07-27, Wed>
3
+ o geom_strip can accept taxa name as input but labeling strip will not supported.
4
+   To support labeling strip, user need to input node id  <2016-07-27, Wed>
4 5
  o nodeid function for converting node label(s) to node id(s) <2016-07-27, Wed> 
5 6
  
6 7
 CHANGES IN VERSION 1.5.6
... ...
@@ -30,7 +30,7 @@ geom_strip <- function(taxa1, taxa2, label=NA, offset=0, offset.text=0,
30 30
     na.rm <- TRUE
31 31
     inherit.aes <- FALSE
32 32
 
33
-    layer_bar <- stat_stripBar(taxa1=taxa1, taxa2=taxa2, offset=offset, align=align,
33
+    layer_bar <- stat_stripBar(taxa1=taxa1, taxa2=taxa2, label=label, offset=offset, align=align,
34 34
                                size=barsize, barextend=barextend,
35 35
                                mapping=mapping, data=data, 
36 36
                                position=position, show.legend = show.legend,
... ...
@@ -67,7 +67,13 @@ stat_stripText <- function(mapping=NULL, data=NULL,
67 67
                            geom="text", position="identity",
68 68
                            taxa1, taxa2, label, offset, align, barextend, ...,
69 69
                            show.legend=NA, inherit.aes=FALSE, na.rm=FALSE) {
70
-    default_aes <- aes_(x=~x, y=~y, node=~node)
70
+
71
+    if (is.null(label) || is.na(label)) {
72
+        default_aes <- aes_(x=~x, y=~y, node=~node, label=~label)
73
+    } else {
74
+        default_aes <- aes_(x=~x, y=~y, node=~node)
75
+    }
76
+    
71 77
     if (is.null(mapping)) {
72 78
         mapping <- default_aes
73 79
     } else {
... ...
@@ -95,9 +101,15 @@ stat_stripText <- function(mapping=NULL, data=NULL,
95 101
 
96 102
 stat_stripBar <- function(mapping=NULL, data=NULL,
97 103
                           geom="segment", position="identity",
98
-                          taxa1, taxa2, offset, align, barextend, ...,
104
+                          taxa1, taxa2, label=label, offset, align, barextend, ...,
99 105
                           show.legend=NA, inherit.aes=FALSE, na.rm=FALSE) {
100
-    default_aes <- aes_(x=~x, y=~y, node=~node)
106
+
107
+    if (is.null(label) || is.na(label)) {
108
+        default_aes <- aes_(x=~x, y=~y, node=~node, label=~label)
109
+    } else {
110
+        default_aes <- aes_(x=~x, y=~y, node=~node)
111
+    }
112
+
101 113
     if (is.null(mapping)) {
102 114
         mapping <- default_aes
103 115
     } else {