Browse code

geom_tiplab2

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

Guangchuang Yu authored on 06/04/2016 13:12:38
Showing 4 changed files

... ...
@@ -46,6 +46,7 @@ export(geom_segment2)
46 46
 export(geom_taxalink)
47 47
 export(geom_text2)
48 48
 export(geom_tiplab)
49
+export(geom_tiplab2)
49 50
 export(geom_tippoint)
50 51
 export(geom_tree)
51 52
 export(geom_tree2)
... ...
@@ -1,5 +1,6 @@
1 1
 CHANGES IN VERSION 1.3.15
2 2
 ------------------------
3
+ o geom_tiplab2 for adding tip label of circular layout <2016-04-06, Wed>
3 4
  o use plot$plot_env to access ggplot2 parameter <2016-04-06, Wed>
4 5
  o geom_taxalink for connecting related taxa <2016-04-01, Fri> 
5 6
  o geom_range for adding range of HPD to present uncertainty of evolutionary inference <2016-04-01, Fri>
... ...
@@ -50,5 +50,28 @@ geom_tiplab <- function(mapping=NULL, hjust = 0, align = FALSE, linetype = "dott
50 50
 }
51 51
 
52 52
 
53
+##' add tip label for circular layout
54
+##'
55
+##' 
56
+##' @title geom_tiplab2
57
+##' @param mapping aes mapping
58
+##' @param ... additional parameter, see geom_tiplab
59
+##' @return tip label layer
60
+##' @export
61
+##' @author Guangchuang Yu
62
+##' @references \url{https://groups.google.com/forum/#!topic/bioc-ggtree/o35PV3iHO-0}
63
+geom_tiplab2 <- function(mapping=NULL, ...) {
53 64
 
65
+    angle <- NULL
66
+    m1 <- aes(subset=(abs(angle) < 90), angle=angle)
67
+    m2 <- aes(subset=(abs(angle) >= 90), angle=angle+180)
68
+        
69
+    if (!is.null(mapping)) {
70
+        m1 <- modifyList(mapping, m1)
71
+        m2 <- modifyList(mapping, m2)
72
+    }
54 73
 
74
+    list(geom_tiplab(m1, ...),
75
+         geom_tiplab(m2, hjust=1, ...)
76
+         )
77
+}
55 78
new file mode 100644
... ...
@@ -0,0 +1,26 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/geom_tiplab.R
3
+\name{geom_tiplab2}
4
+\alias{geom_tiplab2}
5
+\title{geom_tiplab2}
6
+\usage{
7
+geom_tiplab2(mapping = NULL, ...)
8
+}
9
+\arguments{
10
+\item{mapping}{aes mapping}
11
+
12
+\item{...}{additional parameter, see geom_tiplab}
13
+}
14
+\value{
15
+tip label layer
16
+}
17
+\description{
18
+add tip label for circular layout
19
+}
20
+\author{
21
+Guangchuang Yu
22
+}
23
+\references{
24
+\url{https://groups.google.com/forum/#!topic/bioc-ggtree/o35PV3iHO-0}
25
+}
26
+