... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
CHANGES IN VERSION 1.7.4 |
2 | 2 |
------------------------ |
3 |
+ o is.ggtree function to test whether object is produced by ggtree <2016-12-06, Tue> |
|
3 | 4 |
o now branch.length can set to feature available in phylo4d@data and yscale is supported for phylo4d object <2016-12-06, Tue> |
4 | 5 |
o bug fixed of rm.singleton.newick, remove singleton parent instead of singleton <2016-12-01, Thu> |
5 | 6 |
o reorder phylo to postorder before ladderrize <2016-11-28, Mon> |
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
##' drawing phylogenetic tree from phylo object |
2 | 2 |
##' |
3 |
-##' |
|
3 |
+##' |
|
4 | 4 |
##' @title ggtree |
5 | 5 |
##' @param tr phylo object |
6 | 6 |
##' @param mapping aes mapping |
... | ... |
@@ -43,13 +43,13 @@ ggtree <- function(tr, |
43 | 43 |
branch.length = "branch.length", |
44 | 44 |
ndigits = NULL, |
45 | 45 |
...) { |
46 |
- |
|
46 |
+ |
|
47 | 47 |
layout %<>% match.arg(c("rectangular", "slanted", "fan", "circular", "radial", "unrooted")) |
48 | 48 |
|
49 | 49 |
if (is(tr, "r8s") && branch.length == "branch.length") { |
50 | 50 |
branch.length = "TREE" |
51 | 51 |
} |
52 |
- |
|
52 |
+ |
|
53 | 53 |
if(yscale != "none") { |
54 | 54 |
## for 2d tree |
55 | 55 |
layout <- "slanted" |
... | ... |
@@ -76,20 +76,33 @@ ggtree <- function(tr, |
76 | 76 |
} else { |
77 | 77 |
multiPhylo <- FALSE |
78 | 78 |
} |
79 |
- |
|
79 |
+ |
|
80 | 80 |
p <- p + geom_tree(layout=layout, multiPhylo=multiPhylo, ...) |
81 | 81 |
|
82 | 82 |
|
83 | 83 |
p <- p + theme_tree() |
84 |
- |
|
84 |
+ |
|
85 | 85 |
if (layout == "circular" || layout == "radial") { |
86 | 86 |
p <- layout_circular(p) |
87 | 87 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
88 | 88 |
## and also have some space for tree scale (legend) |
89 |
- p <- p + ylim(0, NA) |
|
89 |
+ p <- p + ylim(0, NA) |
|
90 | 90 |
} else if (layout == "fan") { |
91 | 91 |
p <- layout_fan(p, open.angle) |
92 | 92 |
} |
93 | 93 |
|
94 |
+ class(p) <- c("ggtree", class(p)) |
|
95 |
+ |
|
94 | 96 |
return(p) |
95 | 97 |
} |
98 |
+ |
|
99 |
+##' test whether input object is produced by ggtree function |
|
100 |
+##' |
|
101 |
+##' |
|
102 |
+##' @title is.ggtree |
|
103 |
+##' @param x object |
|
104 |
+##' @return TRUE or FALSE |
|
105 |
+##' @export |
|
106 |
+##' @author guangchuang yu |
|
107 |
+is.ggtree <- function(x) inherits(x, 'ggtree') |
|
108 |
+ |
96 | 109 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+% Generated by roxygen2: do not edit by hand |
|
2 |
+% Please edit documentation in R/ggtree.R |
|
3 |
+\name{is.ggtree} |
|
4 |
+\alias{is.ggtree} |
|
5 |
+\title{is.ggtree} |
|
6 |
+\usage{ |
|
7 |
+is.ggtree(x) |
|
8 |
+} |
|
9 |
+\arguments{ |
|
10 |
+\item{x}{object} |
|
11 |
+} |
|
12 |
+\value{ |
|
13 |
+TRUE or FALSE |
|
14 |
+} |
|
15 |
+\description{ |
|
16 |
+test whether input object is produced by ggtree function |
|
17 |
+} |
|
18 |
+\author{ |
|
19 |
+guangchuang yu |
|
20 |
+} |
|
21 |
+ |