... | ... |
@@ -16,7 +16,7 @@ S3method(fortify,phylog) |
16 | 16 |
S3method(fortify,phyloseq) |
17 | 17 |
S3method(fortify,treedata) |
18 | 18 |
S3method(fortify,twins) |
19 |
-S3method(ggplot_add,align_axis) |
|
19 |
+S3method(ggplot_add,axisAlign) |
|
20 | 20 |
S3method(ggplot_add,cladelabel) |
21 | 21 |
S3method(ggplot_add,facet_plot) |
22 | 22 |
S3method(ggplot_add,facet_xlim) |
... | ... |
@@ -45,8 +45,6 @@ export(StatBalance) |
45 | 45 |
export(StatHilight) |
46 | 46 |
export(add_colorbar) |
47 | 47 |
export(aes) |
48 |
-export(align_x) |
|
49 |
-export(align_y) |
|
50 | 48 |
export(annotation_image) |
51 | 49 |
export(arrow) |
52 | 50 |
export(as.polytomy) |
... | ... |
@@ -135,8 +133,10 @@ export(theme_tree2) |
135 | 133 |
export(unit) |
136 | 134 |
export(viewClade) |
137 | 135 |
export(xlim) |
136 |
+export(xlim_align) |
|
138 | 137 |
export(xlim_expand) |
139 | 138 |
export(xlim_tree) |
139 |
+export(ylim_align) |
|
140 | 140 |
exportMethods(gzoom) |
141 | 141 |
exportMethods(scale_color) |
142 | 142 |
importFrom(ape,di2multi) |
... | ... |
@@ -1,7 +1,9 @@ |
1 | 1 |
# ggtree 2.1.1 |
2 | 2 |
|
3 |
-+ `align_x` and `align_y` for setting x or y limits of a ggplot based on another ggplot object (2019-10-31, Thu) |
|
3 |
++ convert roxygen documents using markdown (2019-11-01, Fri) |
|
4 |
++ `xlim_align` and `ylim_align` to uniformize axis limits of ggplot objects (2019-10-31, Thu) |
|
4 | 5 |
- <https://yulab-smu.github.io/treedata-book/chapter7.html#composite_plot> |
6 |
+ - <https://yulab-smu.github.io/treedata-book/docs/chapter10.html#axis_align> |
|
5 | 7 |
+ fixed `fontface` warning message when `align=TRUE` in `geom_tiplab` (2019-10-30, Wed) |
6 | 8 |
- <https://github.com/YuLab-SMU/ggtree/issues/260> |
7 | 9 |
|
... | ... |
@@ -5,7 +5,7 @@ setOldClass("ggtree") |
5 | 5 |
##' @name scale_color |
6 | 6 |
##' @rdname scale_color-methods |
7 | 7 |
##' @title scale_color method |
8 |
-##' @param object \code{treedata} object |
|
8 |
+##' @param object `treedata` object |
|
9 | 9 |
##' @param by one of numerical attributes |
10 | 10 |
##' @param ... additional parameter |
11 | 11 |
##' @return color vector |
... | ... |
@@ -58,29 +58,51 @@ revts <- function(treeview) { |
58 | 58 |
|
59 | 59 |
|
60 | 60 |
|
61 |
-##' set axis limits (x or y specific by 'by' parameter) of a ggplot object (left hand side) |
|
62 |
-##' based on the x (align_x function) or y (align_y function) limits of another ggplot object (right hand side). |
|
63 |
-##' This is useful for using cowplot or patchwork to align ggplot objects. |
|
61 |
+##' set axis limits (x or y) of a `ggplot` object (left hand side of `+`) |
|
62 |
+##' based on the x (`xlim_align`) or y (`ylim_align`) limits of another `ggplot` object (right hand side of `+`). |
|
63 |
+##' This is useful for using `cowplot` or `patchwork` to align `ggplot` objects. |
|
64 | 64 |
##' |
65 | 65 |
##' |
66 |
-##' @title align_x |
|
66 |
+##' @title xlim_align |
|
67 | 67 |
##' @rdname align_axis |
68 | 68 |
##' @param gg ggplot object |
69 |
-##' @param expand_limits amount to expand the limits |
|
70 |
-##' @param by one of 'x' or 'y' |
|
71 |
-##' @return ggplot2 object with new limits and expand |
|
72 |
-##' @importFrom ggplot2 expand_scale |
|
69 |
+##' @param limits vector of limits. If NULL, determine from `gg`. |
|
70 |
+##' @return ggplot2 object with new limits |
|
73 | 71 |
##' @export |
74 | 72 |
##' @author Guangchuang Yu |
75 |
-align_x <- function(gg, expand_limits = expand_scale(0, 0.6), by = 'x') { |
|
76 |
- structure(list(gg = gg, expand_limits = expand_limits, by = by, axis = "x"), |
|
77 |
- class = "align_axis") |
|
73 |
+xlim_align <- function(gg, limits = NULL) { |
|
74 |
+ axis_align(gg = gg, limits = limits, axis = 'x') |
|
78 | 75 |
} |
79 | 76 |
|
80 | 77 |
##' @rdname align_axis |
81 |
-##' @title align_y |
|
78 |
+##' @title ylim_align |
|
82 | 79 |
##' @export |
83 |
-align_y <- function(gg, expand_limits = expand_scale(0, 0.6), by = 'y') { |
|
84 |
- structure(list(gg = gg, expand_limits = expand_limits, by = by, axis = "y"), |
|
85 |
- class = "align_axis") |
|
80 |
+ylim_align <- function(gg, limits = NULL) { |
|
81 |
+ axis_align(gg = gg, limits = limits, axis = 'y') |
|
86 | 82 |
} |
83 |
+ |
|
84 |
+axis_align <- function(gg, limits = NULL, axis) { |
|
85 |
+ if (is.null(limits)) { |
|
86 |
+ if (axis == "x") { |
|
87 |
+ limits <- xrange(gg) |
|
88 |
+ } else { |
|
89 |
+ limits <- yrange(gg) |
|
90 |
+ } |
|
91 |
+ } |
|
92 |
+ structure(list(limits = limits, axis = axis), |
|
93 |
+ class = "axisAlign") |
|
94 |
+} |
|
95 |
+ |
|
96 |
+ |
|
97 |
+yrange <- function(gg) { |
|
98 |
+ ggrange(gg, "y.range") |
|
99 |
+} |
|
100 |
+ |
|
101 |
+xrange <- function(gg) { |
|
102 |
+ ggrange(gg, "x.range") |
|
103 |
+} |
|
104 |
+ |
|
105 |
+ggrange <- function(gg, var) { |
|
106 |
+ ggplot_build(gg)$layout$panel_params[[1]][[var]] |
|
107 |
+} |
|
108 |
+ |
... | ... |
@@ -42,7 +42,7 @@ viewClade <- function(tree_view=NULL, node, xmax_adjust=0) { |
42 | 42 |
## xd <- tree_view$data$branch.length[node]/2 |
43 | 43 |
|
44 | 44 |
cpos <- get_clade_position(tree_view, node=node) |
45 |
- xmax <- ggplot_build(tree_view)$layout$panel_params[[1]]$x.range[2] |
|
45 |
+ xmax <- xrange(tree_view)[2] |
|
46 | 46 |
|
47 | 47 |
attr(tree_view, 'viewClade') <- TRUE |
48 | 48 |
attr(tree_view, 'viewClade_node') <- node |
... | ... |
@@ -51,8 +51,8 @@ phylopic <- function(tree_view, phylopic_id, |
51 | 51 |
##' @param subview a ggplot or grob object |
52 | 52 |
##' @param x x position |
53 | 53 |
##' @param y y position |
54 |
-##' @param width width of subview, [0,1] |
|
55 |
-##' @param height height of subview, [0,1] |
|
54 |
+##' @param width width of subview |
|
55 |
+##' @param height height of subview |
|
56 | 56 |
##' @return ggplot object |
57 | 57 |
##' @importFrom ggplot2 annotation_custom |
58 | 58 |
##' @importFrom ggplot2 ggplotGrob |
... | ... |
@@ -122,7 +122,7 @@ gzoom.ggtree <- function(tree_view, focus, widths=c(.3, .7), xmax_adjust=0) { |
122 | 122 |
##' @title gzoom method |
123 | 123 |
##' @rdname gzoom-methods |
124 | 124 |
##' @exportMethod gzoom |
125 |
-##' @param xmax_adjust adjust xmax (xlim[2]) |
|
125 |
+##' @param xmax_adjust adjust xmax (`xlim[2]`) |
|
126 | 126 |
##' @aliases gzoom,ggtree-method |
127 | 127 |
setMethod("gzoom", signature(object="ggtree"), |
128 | 128 |
function(object, focus, widths=c(.3, .7), xmax_adjust=0) { |
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
##' @title range_format |
5 | 5 |
##' @param x input list |
6 | 6 |
##' @param trans transformation function |
7 |
-##' @return character vector of '[lower, upper]' |
|
7 |
+##' @return character vector of `[lower, upper]` |
|
8 | 8 |
##' @export |
9 | 9 |
##' @author Guangchuang Yu |
10 | 10 |
range_format <- function(x, trans = NULL) { |
... | ... |
@@ -16,8 +16,8 @@ |
16 | 16 |
#' @importFrom ggplot2 GeomRect |
17 | 17 |
#' @importFrom utils packageVersion |
18 | 18 |
#' @author Justin Silverman and modified by Guangchuang Yu |
19 |
-#' @references J. Silverman, et al. \emph{A phylogenetic transform enhances |
|
20 |
-#' analysis of compositional microbiota data}. (in preparation) |
|
19 |
+#' @references J. Silverman, et al. *A phylogenetic transform enhances |
|
20 |
+#' analysis of compositional microbiota data*. (in preparation) |
|
21 | 21 |
geom_balance <- function(node, fill="steelblue", color='white', alpha=.5, extend=0, extendto=NULL) { |
22 | 22 |
|
23 | 23 |
data = NULL |
... | ... |
@@ -7,7 +7,7 @@ |
7 | 7 |
##' @return ggplot layers |
8 | 8 |
##' @export |
9 | 9 |
##' @author JustGitting |
10 |
-##' @seealso \link{geom_cladelabel} |
|
10 |
+##' @seealso [geom_cladelabel] |
|
11 | 11 |
geom_cladelabel2 <- function(node, label, offset=0, offset.text=0, offset.bar=0, |
12 | 12 |
align=FALSE, barsize=0.5, fontsize=3.88, hjust = 0, |
13 | 13 |
geom="text", |
... | ... |
@@ -105,7 +105,7 @@ geom_rootpoint <- function(mapping = NULL, data = NULL, |
105 | 105 |
##' @importFrom ggplot2 layer |
106 | 106 |
##' @export |
107 | 107 |
##' @seealso |
108 |
-##' \link[ggplot2]{geom_point} |
|
108 |
+##' [geom_point][ggplot2::geom_point] |
|
109 | 109 |
##' @return point layer |
110 | 110 |
##' @author Guangchuang Yu |
111 | 111 |
geom_point2 <- function(mapping = NULL, data = NULL, stat = "identity", |
... | ... |
@@ -42,7 +42,7 @@ geom_aline <- function(mapping=NULL, linetype="dotted", size=1, ...) { |
42 | 42 |
##' @importFrom ggplot2 layer |
43 | 43 |
##' @export |
44 | 44 |
##' @seealso |
45 |
-##' \link[ggplot2]{geom_segment} |
|
45 |
+##' [geom_segment][ggplot2::geom_segment] |
|
46 | 46 |
##' @return add segment layer |
47 | 47 |
##' @author Guangchuang Yu |
48 | 48 |
geom_segment2 <- function(mapping = NULL, data = NULL, stat = "identity", |
... | ... |
@@ -95,8 +95,8 @@ geom_tiplab_rectangular <- function(mapping=NULL, hjust = 0, align = FALSE, lin |
95 | 95 |
##' @return tip label layer |
96 | 96 |
##' @export |
97 | 97 |
##' @author Guangchuang Yu |
98 |
-##' @references \url{https://groups.google.com/forum/#!topic/bioc-ggtree/o35PV3iHO-0} |
|
99 |
-##' @seealso \link{geom_tiplab} |
|
98 |
+##' @references <https://groups.google.com/forum/#!topic/bioc-ggtree/o35PV3iHO-0> |
|
99 |
+##' @seealso [geom_tiplab] |
|
100 | 100 |
geom_tiplab2 <- function(mapping=NULL, hjust=0, ...) { |
101 | 101 |
angle <- isTip <- node <- NULL |
102 | 102 |
m1 <- aes(subset=(isTip & (angle < 90 | angle > 270)), angle=angle, node = node) |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
##' visualizing phylogenetic tree and heterogenous associated data based on grammar of graphics |
2 |
-##' \code{ggtree} provides functions for visualizing phylogenetic tree and its associated data in R. |
|
2 |
+##' `ggtree` provides functions for visualizing phylogenetic tree and its associated data in R. |
|
3 | 3 |
##' |
4 | 4 |
##' If you use ggtree in published research, please cite: |
5 | 5 |
##' Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. |
... | ... |
@@ -9,10 +9,10 @@ |
9 | 9 |
##' @param as.Date logical whether using Date class in time tree |
10 | 10 |
##' @param yscale y scale |
11 | 11 |
##' @param yscale_mapping yscale mapping for category variable |
12 |
-##' @param ladderize logical (default \code{TRUE}). Should the tree be re-organized to have a 'ladder' |
|
12 |
+##' @param ladderize logical (default `TRUE`). Should the tree be re-organized to have a 'ladder' |
|
13 | 13 |
##' aspect? |
14 |
-##' @param right logical. If \code{ladderize = TRUE}, should the ladder have the smallest clade on the |
|
15 |
-##' right-hand side? See \code{\link[ape]{ladderize}} for more information. |
|
14 |
+##' @param right logical. If `ladderize = TRUE`, should the ladder have the smallest clade on the |
|
15 |
+##' right-hand side? See [ape::ladderize()] for more information. |
|
16 | 16 |
##' @param branch.length variable for scaling branch, if 'none' draw cladogram |
17 | 17 |
##' @param root.position position of the root node (default = 0) |
18 | 18 |
##' @return tree |
... | ... |
@@ -26,7 +26,7 @@ |
26 | 26 |
##' @importFrom ggplot2 coord_polar |
27 | 27 |
##' @export |
28 | 28 |
##' @author Yu Guangchuang |
29 |
-##' @seealso \code{\link[ape]{ladderize}} |
|
29 |
+##' @seealso [ape::ladderize()] |
|
30 | 30 |
##' @examples |
31 | 31 |
##' require(ape) |
32 | 32 |
##' tr <- rtree(10) |
... | ... |
@@ -21,49 +21,46 @@ ggplot_add.facet_xlim <- function(object, plot, object_name) { |
21 | 21 |
} |
22 | 22 |
|
23 | 23 |
|
24 |
-##' @method ggplot_add align_axis |
|
24 |
+##' @method ggplot_add axisAlign |
|
25 | 25 |
##' @export |
26 |
-ggplot_add.align_axis <- function(object, plot, object_name) { |
|
27 |
- gg <- object$gg |
|
28 |
- v <- get_aes_var(gg$mapping, object$axis) |
|
29 |
- limits <- range(gg$data[[v]]) |
|
30 |
- |
|
31 |
- expand_limits <- object$expand_limits |
|
32 |
- limits[1] <- limits[1] + (limits[1] * expand_limits[1]) - expand_limits[2] |
|
33 |
- limits[2] <- limits[2] + (limits[2] * expand_limits[3]) + expand_limits[4] |
|
26 |
+ggplot_add.axisAlign <- function(object, plot, object_name) { |
|
27 |
+ limits <- object$limits |
|
28 |
+ ## expand_limits <- object$expand_limits |
|
29 |
+ ## limits[1] <- limits[1] + (limits[1] * expand_limits[1]) - expand_limits[2] |
|
30 |
+ ## limits[2] <- limits[2] + (limits[2] * expand_limits[3]) + expand_limits[4] |
|
34 | 31 |
|
35 | 32 |
if (object$axis == 'x') { |
36 |
- if (object$by == "x") { |
|
37 |
- if (is(plot$coordinates, "CoordFlip")) { |
|
38 |
- message("the plot was flipped and the x limits will be applied to y-axis") |
|
39 |
- scale_lim <- scale_y_continuous(limits = limits, expand = c(0, 0)) |
|
40 |
- } else { |
|
41 |
- scale_lim <- scale_x_continuous(limits = limits, expand = c(0, 0)) |
|
42 |
- } |
|
33 |
+ ## if (object$by == "x") { |
|
34 |
+ if (is(plot$coordinates, "CoordFlip")) { |
|
35 |
+ message("the plot was flipped and the x limits will be applied to y-axis") |
|
36 |
+ scale_lim <- scale_y_continuous(limits = limits, expand = c(0, 0)) |
|
43 | 37 |
} else { |
44 |
- if (is(plot$coordinates, "CoordFlip")) { |
|
45 |
- message("the plot was flipped and the x limits will be applied to x-axis") |
|
46 |
- scale_lim <- scale_x_continuous(limits=limits, expand=c(0,0)) |
|
47 |
- } else { |
|
48 |
- scale_lim <- scale_y_continuous(limits=limits, expand=c(0,0)) |
|
49 |
- } |
|
38 |
+ scale_lim <- scale_x_continuous(limits = limits, expand = c(0, 0)) |
|
50 | 39 |
} |
40 |
+ ## } else { |
|
41 |
+ ## if (is(plot$coordinates, "CoordFlip")) { |
|
42 |
+ ## message("the plot was flipped and the x limits will be applied to x-axis") |
|
43 |
+ ## scale_lim <- scale_x_continuous(limits=limits, expand=c(0,0)) |
|
44 |
+ ## } else { |
|
45 |
+ ## scale_lim <- scale_y_continuous(limits=limits, expand=c(0,0)) |
|
46 |
+ ## } |
|
47 |
+ ## } |
|
51 | 48 |
} else { ## axis == 'y' |
52 |
- if (object$by == "x") { |
|
53 |
- if (is(plot$coordinates, "CoordFlip")) { |
|
54 |
- message("the plot was flipped and the y limits will be applied to y-axis") |
|
55 |
- scale_lim <- scale_y_continuous(limits = limits, expand = c(0, 0)) |
|
56 |
- } else { |
|
57 |
- scale_lim <- scale_x_continuous(limits = limits, expand = c(0, 0)) |
|
58 |
- } |
|
49 |
+ ## if (object$by == "x") { |
|
50 |
+ ## if (is(plot$coordinates, "CoordFlip")) { |
|
51 |
+ ## message("the plot was flipped and the y limits will be applied to y-axis") |
|
52 |
+ ## scale_lim <- scale_y_continuous(limits = limits, expand = c(0, 0)) |
|
53 |
+ ## } else { |
|
54 |
+ ## scale_lim <- scale_x_continuous(limits = limits, expand = c(0, 0)) |
|
55 |
+ ## } |
|
56 |
+ ## } else { |
|
57 |
+ if (is(plot$coordinates, "CoordFlip")) { |
|
58 |
+ message("the plot was flipped and the y limits will be applied to x-axis") |
|
59 |
+ scale_lim <- scale_x_continuous(limits=limits, expand=c(0,0)) |
|
59 | 60 |
} else { |
60 |
- if (is(plot$coordinates, "CoordFlip")) { |
|
61 |
- message("the plot was flipped and the y limits will be applied to x-axis") |
|
62 |
- scale_lim <- scale_x_continuous(limits=limits, expand=c(0,0)) |
|
63 |
- } else { |
|
64 |
- scale_lim <- scale_y_continuous(limits=limits, expand=c(0,0)) |
|
65 |
- } |
|
61 |
+ scale_lim <- scale_y_continuous(limits=limits, expand=c(0,0)) |
|
66 | 62 |
} |
63 |
+ ## } |
|
67 | 64 |
} |
68 | 65 |
ggplot_add(scale_lim, plot, object_name) |
69 | 66 |
} |
... | ... |
@@ -78,6 +75,7 @@ ggplot_add.geom_range <- function(object, plot, object_name) { |
78 | 75 |
} |
79 | 76 |
|
80 | 77 |
##' @method ggplot_add layout_ggtree |
78 |
+##' @importFrom ggplot2 expand_scale |
|
81 | 79 |
##' @export |
82 | 80 |
ggplot_add.layout_ggtree <- function(object, plot, object_name) { |
83 | 81 |
if(object$layout == 'fan') { |
... | ... |
@@ -290,13 +290,13 @@ applyLayoutDaylight <- function(df, node_id){ |
290 | 290 |
|
291 | 291 |
|
292 | 292 |
##' Find the right (clockwise rotation, angle from +ve x-axis to furthest subtree nodes) and |
293 |
-##' left (anti-clockwise angle from +ve x-axis to subtree) Returning arc angle in [0, 2] (0 to 360) domain. |
|
293 |
+##' left (anti-clockwise angle from +ve x-axis to subtree) Returning arc angle in `[0, 2]` (0 to 360) domain. |
|
294 | 294 |
##' |
295 | 295 |
##' @title getTreeArcAngles |
296 | 296 |
##' @param df tree data.frame |
297 | 297 |
##' @param origin_id node id from which to calculate left and right hand angles of subtree. |
298 | 298 |
##' @param subtree named list of root id of subtree (node) and list of node ids for given subtree (subtree). |
299 |
-##' @return named list with right and left angles in range [0,2] i.e 1 = 180 degrees, 1.5 = 270 degrees. |
|
299 |
+##' @return named list with right and left angles in range `[0,2]` i.e 1 = 180 degrees, 1.5 = 270 degrees. |
|
300 | 300 |
getTreeArcAngles <- function(df, origin_id, subtree) { |
301 | 301 |
df_x = df$x |
302 | 302 |
df_y = df$y |
... | ... |
@@ -437,11 +437,12 @@ getTreeArcAngles <- function(df, origin_id, subtree) { |
437 | 437 |
|
438 | 438 |
##' Rotate the points in a tree data.frame around a pivot node by the angle specified. |
439 | 439 |
##' |
440 |
-##' @title rotateTreePoints.data.fram |
|
440 |
+##' @title rotateTreePoints.data.frame |
|
441 |
+##' @rdname rotateTreePoints |
|
441 | 442 |
##' @param df tree data.frame |
442 | 443 |
##' @param pivot_node is the id of the pivot node. |
443 | 444 |
##' @param nodes list of node numbers that are to be rotated by angle around the pivot_node |
444 |
-##' @param angle in range [0,2], ie degrees/180, radians/pi |
|
445 |
+##' @param angle in range `[0,2]`, ie degrees/180, radians/pi |
|
445 | 446 |
##' @return updated tree data.frame with points rotated by angle |
446 | 447 |
rotateTreePoints.df <- function(df, pivot_node, nodes, angle){ |
447 | 448 |
# Rotate nodes around pivot_node. |
... | ... |
@@ -477,7 +478,7 @@ rotateTreePoints.df <- function(df, pivot_node, nodes, angle){ |
477 | 478 |
##' @param df tree data.frame |
478 | 479 |
##' @param origin_node_id origin node id number |
479 | 480 |
##' @param node_id end node id number |
480 |
-##' @return angle in range [-1, 1], i.e. degrees/180, radians/pi |
|
481 |
+##' @return angle in range `[-1, 1]`, i.e. degrees/180, radians/pi |
|
481 | 482 |
getNodeAngle.df <- function(df, origin_node_id, node_id){ |
482 | 483 |
if (origin_node_id != node_id) { |
483 | 484 |
df_x = df$x |
... | ... |
@@ -1,28 +1,26 @@ |
1 | 1 |
% Generated by roxygen2: do not edit by hand |
2 |
-% Please edit documentation in R/x-axis.R |
|
3 |
-\name{align_x} |
|
4 |
-\alias{align_x} |
|
5 |
-\alias{align_y} |
|
6 |
-\title{align_x} |
|
2 |
+% Please edit documentation in R/axis.R |
|
3 |
+\name{xlim_align} |
|
4 |
+\alias{xlim_align} |
|
5 |
+\alias{ylim_align} |
|
6 |
+\title{xlim_align} |
|
7 | 7 |
\usage{ |
8 |
-align_x(gg, expand_limits = expand_scale(0, 0.6), by = "x") |
|
8 |
+xlim_align(gg, limits = NULL) |
|
9 | 9 |
|
10 |
-align_y(gg, expand_limits = expand_scale(0, 0.6), by = "y") |
|
10 |
+ylim_align(gg, limits = NULL) |
|
11 | 11 |
} |
12 | 12 |
\arguments{ |
13 | 13 |
\item{gg}{ggplot object} |
14 | 14 |
|
15 |
-\item{expand_limits}{amount to expand the limits} |
|
16 |
- |
|
17 |
-\item{by}{one of 'x' or 'y'} |
|
15 |
+\item{limits}{vector of limits. If NULL, determine from \code{gg}.} |
|
18 | 16 |
} |
19 | 17 |
\value{ |
20 |
-ggplot2 object with new limits and expand |
|
18 |
+ggplot2 object with new limits |
|
21 | 19 |
} |
22 | 20 |
\description{ |
23 |
-set axis limits (x or y specific by 'by' parameter) of a ggplot object (left hand side) |
|
24 |
-based on the x (align_x function) or y (align_y function) limits of another ggplot object (right hand side). |
|
25 |
-This is useful for using cowplot or patchwork to align ggplot objects. |
|
21 |
+set axis limits (x or y) of a \code{ggplot} object (left hand side of \code{+}) |
|
22 |
+based on the x (\code{xlim_align}) or y (\code{ylim_align}) limits of another \code{ggplot} object (right hand side of \code{+}). |
|
23 |
+This is useful for using \code{cowplot} or \code{patchwork} to align \code{ggplot} objects. |
|
26 | 24 |
} |
27 | 25 |
\author{ |
28 | 26 |
Guangchuang Yu |
... | ... |
@@ -32,7 +32,7 @@ correspond to multichotomies will not be displayed. |
32 | 32 |
} |
33 | 33 |
\references{ |
34 | 34 |
J. Silverman, et al. \emph{A phylogenetic transform enhances |
35 |
- analysis of compositional microbiota data}. (in preparation) |
|
35 |
+analysis of compositional microbiota data}. (in preparation) |
|
36 | 36 |
} |
37 | 37 |
\author{ |
38 | 38 |
Justin Silverman and modified by Guangchuang Yu |
... | ... |
@@ -11,7 +11,7 @@ geom_motif(mapping, data, on, label, align = "centre", ...) |
11 | 11 |
|
12 | 12 |
\item{data}{data} |
13 | 13 |
|
14 |
-\item{on}{gene to center (i.e. set middle position of the `on` gene to 0)} |
|
14 |
+\item{on}{gene to center (i.e. set middle position of the \code{on} gene to 0)} |
|
15 | 15 |
|
16 | 16 |
\item{label}{specify a column to be used to label genes} |
17 | 17 |
|
... | ... |
@@ -30,7 +30,7 @@ geom_segment2(mapping = NULL, data = NULL, stat = "identity", |
30 | 30 |
|
31 | 31 |
\item{arrow}{specification for arrow heads, as created by arrow().} |
32 | 32 |
|
33 |
-\item{arrow.fill}{fill color to usse for the arrow head (if closed). `NULL` means use `colour` aesthetic.} |
|
33 |
+\item{arrow.fill}{fill color to usse for the arrow head (if closed). \code{NULL} means use \code{colour} aesthetic.} |
|
34 | 34 |
|
35 | 35 |
\item{...}{additional parameter} |
36 | 36 |
} |
... | ... |
@@ -41,7 +41,7 @@ add segment layer |
41 | 41 |
geom_segment2 support aes(subset) via setup_data |
42 | 42 |
} |
43 | 43 |
\seealso{ |
44 |
-\link[ggplot2]{geom_segment} |
|
44 |
+\link[ggplot2:geom_segment]{geom_segment} |
|
45 | 45 |
} |
46 | 46 |
\author{ |
47 | 47 |
Guangchuang Yu |
... | ... |
@@ -18,7 +18,7 @@ positive values produce right-hand curves, and zero produces a straight line.} |
18 | 18 |
|
19 | 19 |
\item{arrow}{specification for arrow heads, as created by arrow().} |
20 | 20 |
|
21 |
-\item{arrow.fill}{fill color to usse for the arrow head (if closed). `NULL` means use `colour` aesthetic.} |
|
21 |
+\item{arrow.fill}{fill color to usse for the arrow head (if closed). \code{NULL} means use \code{colour} aesthetic.} |
|
22 | 22 |
|
23 | 23 |
\item{...}{additional parameter} |
24 | 24 |
} |
... | ... |
@@ -14,7 +14,7 @@ getNodeAngle.df(df, origin_node_id, node_id) |
14 | 14 |
\item{node_id}{end node id number} |
15 | 15 |
} |
16 | 16 |
\value{ |
17 |
-angle in range [-1, 1], i.e. degrees/180, radians/pi |
|
17 |
+angle in range \code{[-1, 1]}, i.e. degrees/180, radians/pi |
|
18 | 18 |
} |
19 | 19 |
\description{ |
20 | 20 |
Get the angle between the two nodes specified. |
... | ... |
@@ -14,9 +14,9 @@ getTreeArcAngles(df, origin_id, subtree) |
14 | 14 |
\item{subtree}{named list of root id of subtree (node) and list of node ids for given subtree (subtree).} |
15 | 15 |
} |
16 | 16 |
\value{ |
17 |
-named list with right and left angles in range [0,2] i.e 1 = 180 degrees, 1.5 = 270 degrees. |
|
17 |
+named list with right and left angles in range \code{[0,2]} i.e 1 = 180 degrees, 1.5 = 270 degrees. |
|
18 | 18 |
} |
19 | 19 |
\description{ |
20 | 20 |
Find the right (clockwise rotation, angle from +ve x-axis to furthest subtree nodes) and |
21 |
-left (anti-clockwise angle from +ve x-axis to subtree) Returning arc angle in [0, 2] (0 to 360) domain. |
|
21 |
+left (anti-clockwise angle from +ve x-axis to subtree) Returning arc angle in \code{[0, 2]} (0 to 360) domain. |
|
22 | 22 |
} |
... | ... |
@@ -7,7 +7,7 @@ |
7 | 7 |
get_heatmap_column_position(treeview, by = "bottom") |
8 | 8 |
} |
9 | 9 |
\arguments{ |
10 |
-\item{treeview}{output of `gheatmap`} |
|
10 |
+\item{treeview}{output of \code{gheatmap}} |
|
11 | 11 |
|
12 | 12 |
\item{by}{one of 'bottom' or 'top'} |
13 | 13 |
} |
... | ... |
@@ -16,7 +16,7 @@ data.frame |
16 | 16 |
} |
17 | 17 |
\description{ |
18 | 18 |
return a data.frame that contains position information |
19 |
-for labeling column names of heatmap produced by `gheatmap` function |
|
19 |
+for labeling column names of heatmap produced by \code{gheatmap} function |
|
20 | 20 |
} |
21 | 21 |
\author{ |
22 | 22 |
Guangchuang Yu |
... | ... |
@@ -34,7 +34,7 @@ ggtree(tr, mapping = NULL, layout = "rectangular", open.angle = 0, |
34 | 34 |
aspect?} |
35 | 35 |
|
36 | 36 |
\item{right}{logical. If \code{ladderize = TRUE}, should the ladder have the smallest clade on the |
37 |
-right-hand side? See \code{\link[ape]{ladderize}} for more information.} |
|
37 |
+right-hand side? See \code{\link[ape:ladderize]{ape::ladderize()}} for more information.} |
|
38 | 38 |
|
39 | 39 |
\item{branch.length}{variable for scaling branch, if 'none' draw cladogram} |
40 | 40 |
|
... | ... |
@@ -59,7 +59,7 @@ tr <- rtree(10) |
59 | 59 |
ggtree(tr) |
60 | 60 |
} |
61 | 61 |
\seealso{ |
62 |
-\code{\link[ape]{ladderize}} |
|
62 |
+\code{\link[ape:ladderize]{ape::ladderize()}} |
|
63 | 63 |
} |
64 | 64 |
\author{ |
65 | 65 |
Yu Guangchuang |
... | ... |
@@ -21,15 +21,12 @@ tree as data.frame with equal angle layout. |
21 | 21 |
} |
22 | 22 |
\references{ |
23 | 23 |
The following aglorithm aims to implement the vague description of the "Equal-daylight Algorithm" |
24 |
-in "Inferring Phylogenies" pp 582-584 by Joseph Felsenstein. |
|
25 |
- |
|
26 |
-``` |
|
27 |
-Leafs are subtrees with no children |
|
24 |
+in "Inferring Phylogenies" pp 582-584 by Joseph Felsenstein.\preformatted{Leafs are subtrees with no children |
|
28 | 25 |
Initialise tree using equal angle algorithm |
29 | 26 |
tree_df = equal_angle(tree) |
30 | 27 |
|
31 | 28 |
nodes = get list of nodes in tree_df breadth-first |
32 | 29 |
nodes = remove tip nodes. |
33 | 30 |
|
34 |
-``` |
|
31 |
+} |
|
35 | 32 |
} |
... | ... |
@@ -12,7 +12,7 @@ range_format(x, trans = NULL) |
12 | 12 |
\item{trans}{transformation function} |
13 | 13 |
} |
14 | 14 |
\value{ |
15 |
-character vector of '[lower, upper]' |
|
15 |
+character vector of \code{[lower, upper]} |
|
16 | 16 |
} |
17 | 17 |
\description{ |
18 | 18 |
format a list of range (HPD, CI, etc that has length of 2) |
6 | 6 |
similarity index 84% |
7 | 7 |
rename from man/rotateTreePoints.df.Rd |
8 | 8 |
rename to man/rotateTreePoints.Rd |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
% Please edit documentation in R/tree-utilities.R |
3 | 3 |
\name{rotateTreePoints.df} |
4 | 4 |
\alias{rotateTreePoints.df} |
5 |
-\title{rotateTreePoints.data.fram} |
|
5 |
+\title{rotateTreePoints.data.frame} |
|
6 | 6 |
\usage{ |
7 | 7 |
rotateTreePoints.df(df, pivot_node, nodes, angle) |
8 | 8 |
} |
... | ... |
@@ -13,7 +13,7 @@ rotateTreePoints.df(df, pivot_node, nodes, angle) |
13 | 13 |
|
14 | 14 |
\item{nodes}{list of node numbers that are to be rotated by angle around the pivot_node} |
15 | 15 |
|
16 |
-\item{angle}{in range [0,2], ie degrees/180, radians/pi} |
|
16 |
+\item{angle}{in range \code{[0,2]}, ie degrees/180, radians/pi} |
|
17 | 17 |
} |
18 | 18 |
\value{ |
19 | 19 |
updated tree data.frame with points rotated by angle |
... | ... |
@@ -15,9 +15,9 @@ subview(mainview, subview, x, y, width = 0.1, height = 0.1) |
15 | 15 |
|
16 | 16 |
\item{y}{y position} |
17 | 17 |
|
18 |
-\item{width}{width of subview, [0,1]} |
|
18 |
+\item{width}{width of subview} |
|
19 | 19 |
|
20 |
-\item{height}{height of subview, [0,1]} |
|
20 |
+\item{height}{height of subview} |
|
21 | 21 |
} |
22 | 22 |
\value{ |
23 | 23 |
ggplot object |