Browse code

Commit made by the Bioconductor Git-SVN bridge.

Commit id: 4c62d2f58238f5534a0dcd8df6c6a884c0e141be

better geom_tiplab



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

g.yu authored on 31/03/2015 10:30:58
Showing 3 changed files

... ...
@@ -1,5 +1,6 @@
1 1
 CHANGES IN VERSION 0.99.26
2 2
 ------------------------
3
+ o update geom_tiplab <2015-03-31, Tue>
3 4
  o update plot method of beast <2015-03-17, Tue>
4 5
  
5 6
 CHANGES IN VERSION 0.99.25
... ...
@@ -163,12 +163,12 @@ geom_hilight <- function(tree_object, node, ...) {
163 163
 ##' require(ape)
164 164
 ##' tr <- rtree(10)
165 165
 ##' ggtree(tr) + geom_tiplab()
166
-geom_tiplab <- function(align=FALSE, hjust=-.25, ...) {
166
+geom_tiplab <- function(align=FALSE, hjust=0, ...) {
167 167
     x <- y <- label <- isTip <- NULL
168 168
     if (align == TRUE) {
169
-        geom_text(aes(x=max(x), label=label), subset=.(isTip), hjust=hjust, ...)
169
+        geom_text(aes(x=max(x)+ diff(range(x))/200, label=label), subset=.(isTip), hjust=hjust, ...)
170 170
     } else {
171
-        geom_text(aes(label=label), subset=.(isTip), hjust=hjust, ...)
171
+        geom_text(aes(x = x + diff(range(x))/200, label=label), subset=.(isTip), hjust=hjust, ...)
172 172
     }
173 173
 }
174 174
 
... ...
@@ -4,7 +4,7 @@
4 4
 \alias{geom_tiplab}
5 5
 \title{geom_tiplab}
6 6
 \usage{
7
-geom_tiplab(align = FALSE, hjust = -0.25, ...)
7
+geom_tiplab(align = FALSE, hjust = 0, ...)
8 8
 }
9 9
 \arguments{
10 10
 \item{align}{align tip lab or not, logical}