... | ... |
@@ -3,7 +3,7 @@ Type: Package |
3 | 3 |
Title: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
4 | 4 |
Version: 1.7.2 |
5 | 5 |
Authors@R: c( |
6 |
- person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre")), |
|
6 |
+ person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph")), |
|
7 | 7 |
person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com", rol = c("aut", "ths")), |
8 | 8 |
person("Justin", "Silverman", email = "jsilve24@gmail.com", rol = "ctb", comment = "geom_balance"), |
9 | 9 |
person("Casey", "Dunn", email = "casey_dunn@brown.edu", rol = "ctb", |
... | ... |
@@ -1,12 +1,14 @@ |
1 | 1 |
CHANGES IN VERSION 1.7.2 |
2 | 2 |
------------------------ |
3 |
+ o expand_xlim for setting x axis limits of specific panel <2016-11-01, Tue> |
|
4 |
+ + xlim_tree is now a specific case of expand_xlim(xlim, panel='Tree') |
|
3 | 5 |
o bug fixed of parsing tree text in beast file <2016-10-31, Mon> |
4 | 6 |
+ https://github.com/GuangchuangYu/ggtree/issues/84 |
5 | 7 |
|
6 | 8 |
CHANGES IN VERSION 1.7.1 |
7 | 9 |
------------------------ |
8 | 10 |
o xlim_tree layer and test <2016-10-31, Mon> |
9 |
- + set x axis limit for Tree panel for facet_plot |
|
11 |
+ + set x axis limits for Tree panel for facet_plot |
|
10 | 12 |
o update read.nhx <2016-10-30, Sun> |
11 | 13 |
+ add tip numbers to @nhx_tags and add tests |
12 | 14 |
+ https://github.com/GuangchuangYu/ggtree/pull/83 |
... | ... |
@@ -20,25 +20,11 @@ facet_plot <- function(p, panel, data, geom, mapping=NULL, ...) { |
20 | 20 |
##' @importFrom ggplot2 facet_grid |
21 | 21 |
add_panel <- function(p, panel) { |
22 | 22 |
df <- p$data |
23 |
- if (is.null(df$panel)) { |
|
24 |
- df$panel <- factor("Tree") |
|
23 |
+ if (is.null(df$.panel)) { |
|
24 |
+ df$.panel <- factor("Tree") |
|
25 | 25 |
} |
26 |
- levels(df$panel) %<>% c(., panel) |
|
26 |
+ levels(df$.panel) %<>% c(., panel) |
|
27 | 27 |
p$data <- df |
28 |
- p + facet_grid(.~panel, scales="free_x") |
|
29 |
-} |
|
30 |
- |
|
31 |
-##' set x axis limits for Tree panel |
|
32 |
-##' |
|
33 |
-##' |
|
34 |
-##' @title xlim_tree |
|
35 |
-##' @param xlim xlim, should be of length 2 |
|
36 |
-##' @return updated tree view |
|
37 |
-##' @export |
|
38 |
-##' @importFrom ggplot2 geom_blank |
|
39 |
-##' @author guangchuang yu |
|
40 |
-xlim_tree <- function(xlim) { |
|
41 |
- dummy <- data.frame(x=xlim, panel='Tree') |
|
42 |
- geom_blank(aes_(x=~x), dummy, inherit.aes = FALSE) |
|
28 |
+ p + facet_grid(.~.panel, scales="free_x") |
|
43 | 29 |
} |
44 | 30 |
|
... | ... |
@@ -100,19 +100,19 @@ |
100 | 100 |
##' @author Guangchuang Yu |
101 | 101 |
`%+>%` <- function(p, data) { |
102 | 102 |
df <- p$data |
103 |
- lv <- levels(df$panel) |
|
103 |
+ lv <- levels(df$.panel) |
|
104 | 104 |
|
105 | 105 |
if (is(data, "GRanges") || is(data, "GRangesList")) { |
106 | 106 |
names(data) <- df$y[match(names(data), df$label)] |
107 | 107 |
res <- data[order(as.numeric(names(data)))] |
108 | 108 |
mcols <- get_fun_from_pkg("GenomicRanges", "mcols") |
109 | 109 |
`mcols<-` <- get_fun_from_pkg("GenomicRanges", "`mcols<-`") |
110 |
- mcols(res)$panel <- factor(lv[length(lv)], levels=lv) |
|
110 |
+ mcols(res)$.panel <- factor(lv[length(lv)], levels=lv) |
|
111 | 111 |
} else if (is(data, "data.frame") || is(data, "tbl_df")) { |
112 | 112 |
data <- as.data.frame(data) |
113 | 113 |
## res <- merge(df[, c('label', 'y')], data, by.x='label', by.y=1) ## , all.x=TRUE) |
114 | 114 |
res <- merge(df[, !names(df) %in% c('node', 'parent', 'x', 'branch', 'angle')], data, by.x='label', by.y=1) |
115 |
- res$panel <- factor(lv[length(lv)], levels=lv) |
|
115 |
+ res$.panel <- factor(lv[length(lv)], levels=lv) |
|
116 | 116 |
} else { |
117 | 117 |
stop("input 'data' is not supported...") |
118 | 118 |
} |
119 | 119 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+##' set x axis limits for Tree panel |
|
2 |
+##' |
|
3 |
+##' |
|
4 |
+##' @title xlim_tree |
|
5 |
+##' @param xlim xlim |
|
6 |
+##' @return updated tree view |
|
7 |
+##' @export |
|
8 |
+##' @author guangchuang yu |
|
9 |
+xlim_tree <- function(xlim) { |
|
10 |
+ expand_xlim(xlim, panel='Tree') |
|
11 |
+} |
|
12 |
+ |
|
13 |
+ |
|
14 |
+##' expand x axis limits for specific panel |
|
15 |
+##' |
|
16 |
+##' |
|
17 |
+##' @title expand_xlim |
|
18 |
+##' @param xlim xlim |
|
19 |
+##' @param panel panel |
|
20 |
+##' @return updated tree view |
|
21 |
+##' @importFrom ggplot2 geom_blank |
|
22 |
+##' @export |
|
23 |
+##' @author guangchuang yu |
|
24 |
+expand_xlim <- function(xlim, panel) { |
|
25 |
+ dummy <- data.frame(x=xlim, .panel=panel) |
|
26 |
+ geom_blank(aes_(x=~x), dummy, inherit.aes = FALSE) |
|
27 |
+} |
|
28 |
+ |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
2 | 2 |
=========================================================================================================================== |
3 | 3 |
|
4 |
-[](https://bioconductor.org/packages/ggtree) [](https://github.com/GuangchuangYu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
4 |
+[](https://bioconductor.org/packages/ggtree) [](https://github.com/GuangchuangYu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
5 | 5 |
|
6 |
-[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
6 |
+[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
7 | 7 |
|
8 | 8 |
[](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [](https://travis-ci.org/GuangchuangYu/ggtree) [](https://ci.appveyor.com/project/GuangchuangYu/ggtree) [](http://bioconda.github.io/recipes/bioconductor-ggtree/README.html) |
9 | 9 |
|
10 | 10 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,23 @@ |
1 |
+% Generated by roxygen2: do not edit by hand |
|
2 |
+% Please edit documentation in R/xlim.R |
|
3 |
+\name{expand_xlim} |
|
4 |
+\alias{expand_xlim} |
|
5 |
+\title{expand_xlim} |
|
6 |
+\usage{ |
|
7 |
+expand_xlim(xlim, panel) |
|
8 |
+} |
|
9 |
+\arguments{ |
|
10 |
+\item{xlim}{xlim} |
|
11 |
+ |
|
12 |
+\item{panel}{panel} |
|
13 |
+} |
|
14 |
+\value{ |
|
15 |
+updated tree view |
|
16 |
+} |
|
17 |
+\description{ |
|
18 |
+expand x axis limits for specific panel |
|
19 |
+} |
|
20 |
+\author{ |
|
21 |
+guangchuang yu |
|
22 |
+} |
|
23 |
+ |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
% Generated by roxygen2: do not edit by hand |
2 |
-% Please edit documentation in R/facet_plot.R |
|
2 |
+% Please edit documentation in R/xlim.R |
|
3 | 3 |
\name{xlim_tree} |
4 | 4 |
\alias{xlim_tree} |
5 | 5 |
\title{xlim_tree} |
... | ... |
@@ -7,7 +7,7 @@ |
7 | 7 |
xlim_tree(xlim) |
8 | 8 |
} |
9 | 9 |
\arguments{ |
10 |
-\item{xlim}{xlim, should be of length 2} |
|
10 |
+\item{xlim}{xlim} |
|
11 | 11 |
} |
12 | 12 |
\value{ |
13 | 13 |
updated tree view |