Browse code

update man files and fixed R check

Guangchuang Yu authored on 23/03/2022 04:13:34
Showing69 changed files

... ...
@@ -1,15 +1,18 @@
1 1
 Package: ggtree
2 2
 Type: Package
3 3
 Title: an R package for visualization of tree and annotation data
4
-Version: 3.3.1
4
+Version: 3.3.1.900
5 5
 Authors@R: c(
6
-       person("Guangchuang", "Yu",     email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6485-8781")),
6
+       person("Guangchuang", "Yu",     email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), 
7
+            comment = c(ORCID = "0000-0002-6485-8781")),
7 8
        person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com",   role = c("aut", "ths")),
8
-       person("Shuangbin", "Xu",       email = "xshuangbin@163.com",      role = "aut", comment = c(ORCID="0000-0003-3513-5362")),
9
-       person("Yonghe", "Xia",         email = "xiayh17@gmail.com",       role = "ctb"),
10
-       person("Justin", "Silverman",   email = "jsilve24@gmail.com",      role = "ctb"),
9
+       person("Shuangbin", "Xu",       email = "xshuangbin@163.com",      role = "aut", 
10
+            comment = c(ORCID="0000-0003-3513-5362")),
11
+       person("Lin", " Li",            email = "williamlee2220@qq.com",   role = "ctb"),
11 12
        person("Bradley", "Jones",      email = "bjones@cfenet.ubc.ca",    role = "ctb"),
13
+       person("Justin", "Silverman",   email = "jsilve24@gmail.com",      role = "ctb"),
12 14
        person("Watal M.", "Iwasaki",   email = "heavy.watal@gmail.com",   role = "ctb"),
15
+       person("Yonghe", "Xia",         email = "xiayh17@gmail.com",       role = "ctb"),
13 16
        person("Ruizhu", "Huang",       email = "ruizhuRH@gmail.com",      role = "ctb")
14 17
        )
15 18
 Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
... ...
@@ -123,6 +123,7 @@ export(nodeid)
123 123
 export(nodelab)
124 124
 export(nodepie)
125 125
 export(open_tree)
126
+export(plot_list)
126 127
 export(range_format)
127 128
 export(read.tree)
128 129
 export(revts)
... ...
@@ -136,6 +137,7 @@ export(scale_color_subtree)
136 137
 export(scale_colour_manual)
137 138
 export(scale_colour_subtree)
138 139
 export(scale_fill_manual)
140
+export(scale_x_continuous)
139 141
 export(scale_x_ggtree)
140 142
 export(scale_x_range)
141 143
 export(set_hilight_legend)
... ...
@@ -161,6 +163,7 @@ importFrom(ape,ladderize)
161 163
 importFrom(ape,read.tree)
162 164
 importFrom(ape,reorder.phylo)
163 165
 importFrom(ape,rtree)
166
+importFrom(aplot,plot_list)
164 167
 importFrom(aplot,xrange)
165 168
 importFrom(dplyr,collapse)
166 169
 importFrom(dplyr,filter)
... ...
@@ -262,7 +265,6 @@ importFrom(methods,is)
262 265
 importFrom(methods,missingArg)
263 266
 importFrom(methods,setGeneric)
264 267
 importFrom(methods,setOldClass)
265
-importFrom(pillar,style_subtle)
266 268
 importFrom(rlang,.data)
267 269
 importFrom(rlang,abort)
268 270
 importFrom(rlang,as_name)
... ...
@@ -20,12 +20,15 @@
20 20
   - <https://www.rdocumentation.org/packages/phytools/versions/0.7-70/topics/cophylo> 
21 21
 + `fortify` method for `phyloseq` object should return a tidy data.frame
22 22
   - maybe we can defined another object (inherited from treedata?) and provide converter for `phyloseq`
23
-+ update ggtree man files
24 23
 + The `daylight` algorithm is quite slow compare to `ggraph` and needs to  be optimized
25 24
   - <https://github.com/thomasp85/ggraph/commit/14de66f1225336179b4598cb42a4beda95682211>
26 25
 
27 26
 -->
28 27
 
28
+# ggtree 3.3.1.900
29
+
30
++ update man files (2022-03-23, Wed, #489)
31
+
29 32
 # ggtree 3.3.1
30 33
   
31 34
 + use graph layouts to visualize tree (2021-12-10, Fri, #460, #461)
... ...
@@ -110,8 +110,7 @@ scale_x_range <- function() {
110 110
 ##' tr <- rtree(10)
111 111
 ##' p <- ggtree(tr) + theme_tree2()
112 112
 ##' p2 <- revts(p) 
113
-##' p3 <- p2 + scale_x_continuous(labels=abs)
114
-##' plot_list(p, p2, p3, ncol=3, tag_levels="A")
113
+##' p2 + scale_x_continuous(labels=abs)
115 114
 ##' @author Guangchuang Yu
116 115
 revts <- function(treeview) {
117 116
     x <- treeview$data$x
... ...
@@ -191,7 +191,7 @@ collapse.ggtree <- function(x=NULL, node, mode = "none", clade_name = NULL, ...)
191 191
 ##' @inheritParams get_taxa_name
192 192
 ##' @return tree view
193 193
 ##' @export
194
-##' examples
194
+##' @examples
195 195
 ##' x <- rtree(15)
196 196
 ##' p <- ggtree(x) + geom_tiplab()
197 197
 ##' p1 <- collapse(p, 17)
... ...
@@ -300,10 +300,12 @@ rotate <- function(tree_view=NULL, node) {
300 300
 ##' @param node2 node number of clade 2. It should share a same parent node with node1
301 301
 ##' @return ggplot object
302 302
 ##' @export
303
+##' @examples
304
+##' set.seed(123)
303 305
 ##' x <- rtree(15)
304 306
 ##' p <- ggtree(x) + geom_tiplab() +
305 307
 ##'   geom_nodelab(aes(subset=!isTip, label=node), hjust = -.1, color = "red")
306
-##' flip(p, 19, 20)   ## Depends on the condition of your tree
308
+##' flip(p, 23, 24)   ## Depends on the condition of your tree
307 309
 ##' @author Guangchuang Yu
308 310
 flip <- function(tree_view=NULL, node1, node2) {
309 311
     tree_view %<>% get_tree_view
... ...
@@ -31,6 +31,8 @@
31 31
 ##' @export
32 32
 ##' @author Yu Guangchuang
33 33
 ##' @examples
34
+##' tree <- rtree(10)
35
+##' ggplot(tree) + geom_tree()
34 36
 ##' @references
35 37
 ##' For demonstration of this function, please refer to chapter 4.2.1 of 
36 38
 ##' *Data Integration, Manipulation and Visualization of Phylogenetic Trees*
... ...
@@ -22,8 +22,6 @@
22 22
 ##' For demonstration of this function, please refer to chapter 8.3 of 
23 23
 ##' *Data Integration, Manipulation and Visualization of Phylogenetic Trees*
24 24
 ##' <http://yulab-smu.top/treedata-book/index.html> by Guangchuang Yu.
25
-##' 
26
-
27 25
 geom_inset <- function(insets, width = .1, height = .1, hjust = 0, vjust = 0,
28 26
                        x = "node", reverse_x = FALSE, reverse_y = FALSE) {
29 27
     structure(list(insets = insets, width = width, height = height,
... ...
@@ -37,7 +35,6 @@ geom_inset <- function(insets, width = .1, height = .1, hjust = 0, vjust = 0,
37 35
 ##' @title inset
38 36
 ##' @rdname inset
39 37
 ##' @param tree_view tree view 
40
-##' @inheritParams geom_inset
41 38
 ##' @return tree view with insets
42 39
 ##' @importFrom yulab.utils get_fun_from_pkg
43 40
 ##' @export
... ...
@@ -13,7 +13,6 @@
13 13
 ##' @param height height ratio of sequence, defaults to 0.8
14 14
 ##' @return tree view
15 15
 ##' @export
16
-##' @importFrom colorspace rainbow_hcl
17 16
 ##' @importFrom treeio read.fasta
18 17
 ##' @importFrom ggplot2 geom_segment
19 18
 ##' @importFrom ggplot2 geom_rect
... ...
@@ -86,6 +86,10 @@ ggplot2::scale_color_manual
86 86
 ##' @export
87 87
 ggplot2::scale_fill_manual
88 88
 
89
+##' @importFrom ggplot2 scale_x_continuous
90
+##' @export
91
+ggplot2::scale_x_continuous
92
+
89 93
 ##' @importFrom ggplot2 margin
90 94
 ##' @export
91 95
 ggplot2::margin
... ...
@@ -97,3 +101,8 @@ grid::arrow
97 101
 ##' @importFrom grid unit
98 102
 ##' @export
99 103
 grid::unit
104
+
105
+
106
+##' @importFrom aplot plot_list
107
+##' @export
108
+aplot::plot_list
... ...
@@ -19,4 +19,3 @@ scale_x_ggtree <- function(breaks = waiver(), labels = waiver()) {
19 19
     structure(list(breaks = breaks, labels = labels), class="scale_ggtree")
20 20
 }
21 21
 
22
-
... ...
@@ -7,7 +7,7 @@
7 7
 as.polytomy(tree, feature, fun)
8 8
 }
9 9
 \arguments{
10
-\item{tree}{tree object}
10
+\item{tree}{tree object, 'phylo' object only}
11 11
 
12 12
 \item{feature}{selected feature}
13 13
 
... ...
@@ -9,7 +9,7 @@ pg \%<+\% data
9 9
 \arguments{
10 10
 \item{pg}{ggplot2 object}
11 11
 
12
-\item{data}{annotation data}
12
+\item{data}{annotation data that contains a column of “node” , or the first column of taxa labels}
13 13
 }
14 14
 \value{
15 15
 ggplot object with annotation data added
... ...
@@ -17,6 +17,9 @@ ggplot object with annotation data added
17 17
 \description{
18 18
 add annotation data to a tree
19 19
 }
20
+\details{
21
+This operator attaches annotation data to a ggtree graphic object
22
+}
20 23
 \examples{
21 24
 nwk <- system.file("extdata", "sample.nwk", package="treeio")
22 25
 tree <- read.tree(nwk)
... ...
@@ -11,17 +11,24 @@
11 11
 
12 12
 \item{node}{internal node number}
13 13
 
14
-\item{mode}{one of 'none', 'max', 'min' and 'mixed'}
14
+\item{mode}{one of 'none'(default), 'max', 'min' and 'mixed'. 'none' would simply collapse the clade as 'tip' and
15
+the rest will display a triangle, whose shape is determined by the farest/closest tip of the collapsed clade to indicate it}
15 16
 
16
-\item{clade_name}{set clade name. If clade_name = NULL, do nothing}
17
+\item{clade_name}{set a name for the collapsed clade. If clade_name = NULL, do nothing}
17 18
 
18
-\item{...}{additional parameters}
19
+\item{...}{additional parameters to set the color or transparency of the triangle}
19 20
 }
20 21
 \value{
21 22
 tree view
22 23
 }
23 24
 \description{
24
-collapse a clade
25
+collapse a selected clade, which can later be expanded with the 'expand()' fuction if necessary
26
+}
27
+\examples{
28
+x <- rtree(15)
29
+p <- ggtree(x) + geom_tiplab()
30
+p
31
+p1 <- collapse(p, node = 17, mode = "mixed", clade_name = "cclade", alpha = 0.8, color = "grey", fill = "light blue")
25 32
 }
26 33
 \seealso{
27 34
 expand
... ...
@@ -7,7 +7,7 @@
7 7
 expand(tree_view = NULL, node)
8 8
 }
9 9
 \arguments{
10
-\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot will be used.}
10
+\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot object will be used.}
11 11
 
12 12
 \item{node}{internal node number to specify a clade. If NULL, using the whole tree}
13 13
 }
... ...
@@ -15,7 +15,13 @@ expand(tree_view = NULL, node)
15 15
 tree view
16 16
 }
17 17
 \description{
18
-expand collased clade
18
+expand collapsed clade
19
+}
20
+\examples{
21
+x <- rtree(15)
22
+p <- ggtree(x) + geom_tiplab()
23
+p1 <- collapse(p, 17)
24
+expand(p1, 17)
19 25
 }
20 26
 \seealso{
21 27
 collapse
... ...
@@ -9,13 +9,13 @@ facet_labeller(p, label)
9 9
 \arguments{
10 10
 \item{p}{facet_plot output}
11 11
 
12
-\item{label}{labels of facet panels}
12
+\item{label}{new labels of facet panels}
13 13
 }
14 14
 \value{
15 15
 ggplot object
16 16
 }
17 17
 \description{
18
-label facet_plot output
18
+function to relable selected panels created by 'geom_facet' or 'facet-plot'
19 19
 }
20 20
 \author{
21 21
 Guangchuang Yu
... ...
@@ -9,15 +9,22 @@ flip(tree_view = NULL, node1, node2)
9 9
 \arguments{
10 10
 \item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot will be used.}
11 11
 
12
-\item{node1}{node number of branch 1}
12
+\item{node1}{node number of clade 1. It should share a same parent node with node2}
13 13
 
14
-\item{node2}{node number of branch 2}
14
+\item{node2}{node number of clade 2. It should share a same parent node with node1}
15 15
 }
16 16
 \value{
17
-ggplot2 object
17
+ggplot object
18 18
 }
19 19
 \description{
20
-flip position of two selected branches
20
+exchange the position of 2 clades
21
+}
22
+\examples{
23
+set.seed(123)
24
+x <- rtree(15)
25
+p <- ggtree(x) + geom_tiplab() +
26
+  geom_nodelab(aes(subset=!isTip, label=node), hjust = -.1, color = "red")
27
+flip(p, 23, 24)   ## Depends on the condition of your tree
21 28
 }
22 29
 \author{
23 30
 Guangchuang Yu
... ...
@@ -10,13 +10,13 @@ geom_hilight(data = NULL, mapping = NULL, node = NULL, type = "auto", ...)
10 10
 geom_highlight(data = NULL, mapping = NULL, node = NULL, type = "auto", ...)
11 11
 }
12 12
 \arguments{
13
-\item{data}{data.frame, The data to be displayed in this layer, default is NULL.}
13
+\item{data}{data.frame, The data to be displayed in this layer, defaults to NULL.}
14 14
 
15
-\item{mapping}{Set of aesthetic mappings, default is NULL.}
15
+\item{mapping}{Set of aesthetic mappings, defaults to NULL.}
16 16
 
17 17
 \item{node}{selected node to hilight, when data and mapping is NULL, it is required.}
18 18
 
19
-\item{type}{the type of layer, default is \code{auto}, meaning rectangular, circular,
19
+\item{type}{the type of layer, defaults to \code{auto}, meaning rectangular, circular,
20 20
 slanted, fan, inward_circular, radial, equal_angle, ape layout tree will use rectangular layer,
21 21
 unrooted and daylight layout tree use will use encircle layer. You can specify this parameter to
22 22
 \code{rect} (rectangular layer) or \code{encircle} (encircle layer), 'gradient' (gradient color),
... ...
@@ -27,12 +27,12 @@ unrooted and daylight layout tree use will use encircle layer. You can specify t
27 27
 \item \code{align} control the align direction of the edge of high light rectangular.
28 28
 Options is 'none' (default), 'left', 'right', 'both'. This argument only work when the
29 29
 'geom_hilight' is plotting using geom_hilight(mapping=aes(...)).
30
-\item \code{gradient.direction} character, the direction of gradient color, default is 'rt'
30
+\item \code{gradient.direction} character, the direction of gradient color, defaults to 'rt'
31 31
 meaning the locations of gradient color is from root to tip, options are 'rt' and 'tr'.
32 32
 \item \code{gradient.length.out} integer, desired length of the sequence of gradient color,
33
-default is 2.
33
+defaults to 2.
34 34
 \item \code{roundrect.r} numeric, the radius of the rounded corners, when \code{roundrect=TRUE},
35
-default is 0.05.
35
+defaults to 0.05.
36 36
 }}
37 37
 }
38 38
 \value{
... ...
@@ -51,27 +51,27 @@ you can see the Aesthetics section to set parameters.
51 51
 aesthetics are in bold):
52 52
 \itemize{
53 53
 \item \strong{\code{node}} selected node to hight light, it is required.
54
-\item \code{colour} the colour of margin, default is NA.
55
-\item \code{fill} the colour of fill, default is 'steelblue'.
56
-\item \code{alpha} the transparency of fill, default is 0.5.
57
-\item \code{extend} extend xmax of the rectangle, default is 0.
58
-\item \code{extendto} specify a value, meaning the rectangle extend to, default is NULL.
59
-\item \code{linetype} the line type of margin, default is 1.
60
-\item \code{size} the width of line of margin, default is 0.5.
54
+\item \code{colour} the colour of margin, defaults to NA.
55
+\item \code{fill} the colour of fill, defaults to 'steelblue'.
56
+\item \code{alpha} the transparency of fill, defaults to 0.5.
57
+\item \code{extend} extend xmax of the rectangle, defaults to 0.
58
+\item \code{extendto} specify a value, meaning the rectangle extend to, defaults to NULL.
59
+\item \code{linetype} the line type of margin, defaults to 1.
60
+\item \code{size} the width of line of margin, defaults to 0.5.
61 61
 }
62 62
 \code{geom_hilight()} understands the following aesthethics for encircle layer (required
63 63
 aesthetics are in bold):
64 64
 \itemize{
65 65
 \item \strong{\code{node}} selected node to hight light, it is required.
66
-\item \code{colour} the colour of margin, default is 'black'.
67
-\item \code{fill} the colour of fill, default is 'steelblue'.
68
-\item \code{alpha} the transparency of fill, default is 0.5.
69
-\item \code{expand} expands the xspline clade region, default is 0.
66
+\item \code{colour} the colour of margin, defaults to 'black'.
67
+\item \code{fill} the colour of fill, defaults to 'steelblue'.
68
+\item \code{alpha} the transparency of fill, defaults to 0.5.
69
+\item \code{expand} expands the xspline clade region, defaults to 0.
70 70
 \item \code{spread} control the size, when only one point.
71
-\item \code{size} the width of line of margin, default is 0.5.
72
-\item \code{linetype} the line type of margin, default is 1.
73
-\item \code{s_shape} the shape of the spline relative to the control points, default is 0.5.
74
-\item \code{s_open}  whether the spline is a line or a closed shape, default is FALSE.
71
+\item \code{size} the width of line of margin, defaults to 0.5.
72
+\item \code{linetype} the line type of margin, defaults to 1.
73
+\item \code{s_shape} the shape of the spline relative to the control points, defaults to 0.5.
74
+\item \code{s_open}  whether the spline is a line or a closed shape, defaults to FALSE.
75 75
 }
76 76
 }
77 77
 
... ...
@@ -95,6 +95,11 @@ p7 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), type = "gradie
95 95
 p8 <- p + geom_hilight(data=dat, mapping=aes(node=id, fill=type), type = "roundrect", alpha=0.68)
96 96
 p2/ p3/ p4/ p5 / p6/ p7/ p8
97 97
 }
98
+\references{
99
+For more detailed demonstration, please refer to chapter 5.2.2 of
100
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
101
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
102
+}
98 103
 \author{
99 104
 Guangchuang Yu and Shuangbin Xu
100 105
 }
... ...
@@ -9,9 +9,9 @@ geom_aline(mapping = NULL, linetype = "dotted", size = 1, ...)
9 9
 \arguments{
10 10
 \item{mapping}{aes mapping}
11 11
 
12
-\item{linetype}{line type}
12
+\item{linetype}{set line type of the line, defaults to "dotted"}
13 13
 
14
-\item{size}{line size}
14
+\item{size}{set line size of the line, defaults to 1}
15 15
 
16 16
 \item{...}{additional parameter}
17 17
 }
... ...
@@ -19,7 +19,11 @@ geom_aline(mapping = NULL, linetype = "dotted", size = 1, ...)
19 19
 aline layer
20 20
 }
21 21
 \description{
22
-add horizontal align lines
22
+add horizontal align lines layer to a tree
23
+}
24
+\details{
25
+'geom_aline'align all tips to the longest one by adding
26
+padding characters to the right side of the tip.
23 27
 }
24 28
 \author{
25 29
 Yu Guangchuang
... ...
@@ -14,17 +14,17 @@ geom_balance(
14 14
 )
15 15
 }
16 16
 \arguments{
17
-\item{node}{selected node (balance) to highlight}
17
+\item{node}{selected node (balance) to highlight its two direct descendant}
18 18
 
19
-\item{fill}{color fill}
19
+\item{fill}{color to fill in the highlight rectangle, default to "steelblue"}
20 20
 
21
-\item{color}{color to outline highlights and divide balance}
21
+\item{color}{color to outline highlight rectangle and divide balance, defaults to "white"}
22 22
 
23
-\item{alpha}{alpha (transparency)}
23
+\item{alpha}{alpha (transparency) for the highlight rectangle, defaults to 0.5}
24 24
 
25
-\item{extend}{extend xmax of the rectangle}
25
+\item{extend}{extend xmax of the highlight rectangle by the value of extend}
26 26
 
27
-\item{extendto}{extend xmax to extendto}
27
+\item{extendto}{extend xmax of the highlight rectangle to the value of extendto}
28 28
 }
29 29
 \value{
30 30
 ggplot2
... ...
@@ -35,10 +35,22 @@ highlights the two direct descendant clades of an internal node
35 35
 \details{
36 36
 Particularly useful when studying neighboring clades. Note that balances that
37 37
 correspond to multichotomies will not be displayed.
38
+}
39
+\examples{
40
+library(ggtree)
41
+set.seed(123)
42
+tr<- rtree(15)
43
+x <- ggtree(tr)
44
+x + geom_balance(17)
45
+
38 46
 }
39 47
 \references{
40 48
 J. Silverman, et al. \emph{A phylogenetic transform enhances
41 49
 analysis of compositional microbiota data}. (in preparation)
50
+
51
+For more detailed demonstration, please refer to chapter 5.2.2 of
52
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
53
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
42 54
 }
43 55
 \author{
44 56
 Justin Silverman and modified by Guangchuang Yu
... ...
@@ -19,34 +19,34 @@ geom_cladelab(
19 19
 
20 20
 \item{label}{character, character to be showed, when data and mapping is NULL, it is required.}
21 21
 
22
-\item{data}{data.frame, the data to be displayed in the annotation, default is NULL.}
22
+\item{data}{data.frame, the data to be displayed in the annotation, defaults to NULL.}
23 23
 
24
-\item{mapping}{Set of aesthetic mappings, default is NULL. The detail see the following explanation.}
24
+\item{mapping}{Set of aesthetic mappings, defaults to NULL. The detail see the following explanation.}
25 25
 
26 26
 \item{geom}{character, one of 'text', 'label', 'shadowtext', 'image' and 'phylopic',
27
-default is 'text', and the parameter see the Aesthetics For Specified Geom.}
27
+defaults to 'text', and the parameter see the Aesthetics For Specified Geom.}
28 28
 
29
-\item{parse}{logical, whether parse label to emoji font, default is FALSE.}
29
+\item{parse}{logical, whether parse label to emoji font, defaults to FALSE.}
30 30
 
31 31
 \item{...}{additional parameters, see also following section.
32 32
 
33 33
 additional parameters can refer the following parameters.
34 34
 \itemize{
35 35
 \item \code{offset} distance bar and tree, offset of bar and text from
36
-the clade, default is 0.
36
+the clade, defaults to 0.
37 37
 \item \code{offset.text} distance bar and text, offset of text from bar,
38
-default is 0.
39
-\item \code{align} logical, whether align clade lab, default is FALSE.
40
-\item \code{extend} numeric, extend the length of bar, default is 0.
38
+defaults to 0.
39
+\item \code{align} logical, whether align clade lab, defaults to FALSE.
40
+\item \code{extend} numeric, extend the length of bar, defaults to 0.
41 41
 \item \code{angle} numeric or 'auto', if angle is auto, the angle of text will
42
-be calculated automatically, which is useful for the circular etc layout, default is 0.
43
-\item \code{horizontal} logical, whether set label to horizontal, default is TRUE.
44
-\item \code{barsize} the width of line, default is 0.5.
45
-\item \code{barcolour} the colour of line, default is 'black'.
46
-\item \code{fontsize} the size of text, default is 3.88.
47
-\item \code{textcolour} the colour of text, default is 'black'.
48
-\item \code{imagesize} the size of image, default is 0.05.
49
-\item \code{imagecolor} the colour of image, default is NULL, when
42
+be calculated automatically, which is useful for the circular etc layout, defaults to 0.
43
+\item \code{horizontal} logical, whether set label to horizontal, defaults to TRUE.
44
+\item \code{barsize} the width of line, defaults to 0.5.
45
+\item \code{barcolour} the colour of line, defaults to 'black'.
46
+\item \code{fontsize} the size of text, defaults to 3.88.
47
+\item \code{textcolour} the colour of text, defaults to 'black'.
48
+\item \code{imagesize} the size of image, defaults to 0.05.
49
+\item \code{imagecolor} the colour of image, defaults to NULL, when
50 50
 geom="phylopic", it should be required.
51 51
 }
52 52
 The parameters also can be set in mapping, when data is provided. Note: the barsize, barcolour,
... ...
@@ -64,16 +64,16 @@ aesthetics are in bold):
64 64
 \itemize{
65 65
 \item \strong{\code{node}} selected node to hight light, it is required.
66 66
 \item \strong{\code{label}} labels showed, it is required.
67
-\item \code{colour} the colour of text, default is "black".
68
-\item \code{size} the size of text, default is 3.88.
69
-\item \code{angle} the angle of text, default is 0.
70
-\item \code{hjust} A numeric vector specifying horizontal justification, default is 0.
71
-\item \code{vjust} A numeric vector specifying vertical justification, default is 0.5.
72
-\item \code{alpha} the transparency of text, default is NA.
73
-\item \code{family} the family of text, default is 'sans'.
74
-\item \code{fontface} the font face of text, default is 1 (plain), others are
67
+\item \code{colour} the colour of text, defaults to "black".
68
+\item \code{size} the size of text, defaults to 3.88.
69
+\item \code{angle} the angle of text, defaults to 0.
70
+\item \code{hjust} A numeric vector specifying horizontal justification, defaults to 0.
71
+\item \code{vjust} A numeric vector specifying vertical justification, defaults to 0.5.
72
+\item \code{alpha} the transparency of text, defaults to NA.
73
+\item \code{family} the family of text, defaults to 'sans'.
74
+\item \code{fontface} the font face of text, defaults to 1 (plain), others are
75 75
 2 (bold), 3 (italic), 4 (bold.italic).
76
-\item \code{lineheight} The height of a line as a multiple of the size of text, default is 1.2 .
76
+\item \code{lineheight} The height of a line as a multiple of the size of text, defaults to 1.2 .
77 77
 }
78 78
 when the colour, size are not be set in mapping, and user want to modify the colour of text,
79 79
 they should use textcolour, fontsize to avoid the confusion with bar layer annotation.
... ...
@@ -83,17 +83,17 @@ aesthetics are in bold):
83 83
 \itemize{
84 84
 \item \strong{\code{node}} selected node to hight light, it is required.
85 85
 \item \strong{\code{label}} labels to be showed, it is required.
86
-\item \code{colour} the colour of text, default is "black".
87
-\item \code{fill} the background colour of the label, default is "white".
88
-\item \code{size} the size of text, default is 3.88.
89
-\item \code{angle} the angle of text, default is 0.
90
-\item \code{hjust} A numeric vector specifying horizontal justification, default is 0.
91
-\item \code{vjust} A numeric vector specifying vertical justification, default is 0.5.
92
-\item \code{alpha} the transparency of text, default is NA.
93
-\item \code{family} the family of text, default is 'sans'.
94
-\item \code{fontface} the font face of text, default is 1 (plain), others are
86
+\item \code{colour} the colour of text, defaults to "black".
87
+\item \code{fill} the background colour of the label, defaults to "white".
88
+\item \code{size} the size of text, defaults to 3.88.
89
+\item \code{angle} the angle of text, defaults to 0.
90
+\item \code{hjust} A numeric vector specifying horizontal justification, defaults to 0.
91
+\item \code{vjust} A numeric vector specifying vertical justification, defaults to 0.5.
92
+\item \code{alpha} the transparency of text, defaults to NA.
93
+\item \code{family} the family of text, defaults to 'sans'.
94
+\item \code{fontface} the font face of text, defaults to 1 (plain), others are
95 95
 2 (bold), 3 (italic), 4 (bold.italic).
96
-\item \code{lineheight} The height of a line as a multiple of the size of text, default is 1.2 .
96
+\item \code{lineheight} The height of a line as a multiple of the size of text, defaults to 1.2 .
97 97
 }
98 98
 when the colour, size are not be set in mapping, and user want to modify the colour of text,
99 99
 they should use textcolour, fontsize to avoid the confusion with bar layer annotation.
... ...
@@ -103,18 +103,18 @@ aesthetics are in bold):
103 103
 \itemize{
104 104
 \item \strong{\code{node}} selected node to hight light, it is required.
105 105
 \item \strong{\code{label}} labels to be showed, it is required.
106
-\item \code{colour} the colour of text, default is "black".
107
-\item \code{bg.colour} the background colour of text, default is 'black'.
108
-\item \code{bg.r} the width of background text, default is 0.1.
109
-\item \code{size} the size of text, default is 3.88.
110
-\item \code{angle} the angle of text, default is 0.
111
-\item \code{hjust} A numeric vector specifying horizontal justification, default is 0.
112
-\item \code{vjust} A numeric vector specifying vertical justification, default is 0.5.
113
-\item \code{alpha} the transparency of text, default is NA.
114
-\item \code{family} the family of text, default is 'sans'.
115
-\item \code{fontface} the font face of text, default is 1 (plain), others are
106
+\item \code{colour} the colour of text, defaults to "black".
107
+\item \code{bg.colour} the background colour of text, defaults to 'black'.
108
+\item \code{bg.r} the width of background text, defaults to 0.1.
109
+\item \code{size} the size of text, defaults to 3.88.
110
+\item \code{angle} the angle of text, defaults to 0.
111
+\item \code{hjust} A numeric vector specifying horizontal justification, defaults to 0.
112
+\item \code{vjust} A numeric vector specifying vertical justification, defaults to 0.5.
113
+\item \code{alpha} the transparency of text, defaults to NA.
114
+\item \code{family} the family of text, defaults to 'sans'.
115
+\item \code{fontface} the font face of text, defaults to 1 (plain), others are
116 116
 2 (bold), 3 (italic), 4 (bold.italic).
117
-\item \code{lineheight} The height of a line as a multiple of the size of text, default is 1.2 .
117
+\item \code{lineheight} The height of a line as a multiple of the size of text, defaults to 1.2 .
118 118
 }
119 119
 when the colour, size are not be set in mapping, and user want to modify the colour of text,
120 120
 they should use textcolour, fontsize to avoid the confusion with bar layer annotation.
... ...
@@ -126,9 +126,9 @@ aesthetics are in bold):
126 126
 \item \strong{\code{label}} labels to be showed, it is required.
127 127
 \item \strong{\code{image}} the image to be annotated, when geom="phylopic",
128 128
 the uid of phylopic databases, it is required.
129
-\item \code{colour} the color of image, default is NULL.
130
-\item \code{size} the size of image, default is 0.05.
131
-\item \code{alpha} the alpha of image, default is 0.8.
129
+\item \code{colour} the color of image, defaults to NULL.
130
+\item \code{size} the size of image, defaults to 0.05.
131
+\item \code{alpha} the alpha of image, defaults to 0.8.
132 132
 }
133 133
 when the colour, size are not be set in mapping, and user want to modify the colour of image,
134 134
 they should use imagecolour, imagesize to avoid the confusion with bar layer annotation.
... ...
@@ -56,7 +56,7 @@ geom_cladelabel(
56 56
 \item{parse}{logical, whether parse label}
57 57
 
58 58
 \item{horizontal}{logical, whether set label to horizontal,
59
-default is TRUE.}
59
+defaults to TRUE.}
60 60
 
61 61
 \item{...}{additional parameter}
62 62
 }
... ...
@@ -50,7 +50,7 @@ geom_cladelabel2(
50 50
 \item{parse}{logical, whether parse label}
51 51
 
52 52
 \item{horizontal}{logical, whether set label to horizontal,
53
-default is TRUE.}
53
+defaults to TRUE.}
54 54
 
55 55
 \item{...}{additional parameter}
56 56
 }
... ...
@@ -23,36 +23,36 @@ geom_label2(
23 23
 )
24 24
 }
25 25
 \arguments{
26
-\item{mapping}{the aesthetic mapping}
26
+\item{mapping}{Set of aesthetic mappings, defaults to NULL.}
27 27
 
28 28
 \item{data}{A layer specific dataset -
29 29
 only needed if you want to override the plot defaults.}
30 30
 
31
-\item{...}{other arguments passed on to 'layer'}
31
+\item{...}{other arguments passed on to 'layer'.}
32 32
 
33
-\item{stat}{Name of stat to modify data}
33
+\item{stat}{Name of the stat to modify data.}
34 34
 
35
-\item{position}{The position adjustment to use for overlapping points on this layer}
35
+\item{position}{The position adjustment to use for overlapping points on this layer.}
36 36
 
37
-\item{family}{sans by default, can be any supported font}
37
+\item{family}{"sans" by default, can be any supported font.}
38 38
 
39
-\item{parse}{if TRUE, the labels will be parsed as expressions}
39
+\item{parse}{if 'TRUE', the labels will be parsed as expressions, defaults to 'FALSE'.}
40 40
 
41
-\item{nudge_x}{horizontal adjustment}
41
+\item{nudge_x}{adjust the horizontal position of the labels.}
42 42
 
43
-\item{nudge_y}{vertical adjustment}
43
+\item{nudge_y}{adjust the vertical position of the labels.}
44 44
 
45
-\item{label.padding}{Amount of padding around label.}
45
+\item{label.padding}{Amount of padding around label, defaults to 'unit(0.25, "lines")'.}
46 46
 
47
-\item{label.r}{Radius of rounded corners.}
47
+\item{label.r}{Use to set the radius of rounded corners of the label, defaults to 'unit(0.15, "lines")'.}
48 48
 
49
-\item{label.size}{Size of label border, in mm}
49
+\item{label.size}{Size of label border, in mm, defaults to 0.25.}
50 50
 
51
-\item{na.rm}{logical}
51
+\item{na.rm}{If "FALSE" (default), missing values are removed with a warning. If "TRUE", missing values are silently removed, logical.}
52 52
 
53
-\item{show.legend}{logical}
53
+\item{show.legend}{Whether to show legend, logical, defaults to "NA".}
54 54
 
55
-\item{inherit.aes}{logical}
55
+\item{inherit.aes}{Whether to inherit aesthetic mappings, logical, defaults to "TRUE".}
56 56
 }
57 57
 \value{
58 58
 label layer
... ...
@@ -60,6 +60,21 @@ label layer
60 60
 \description{
61 61
 geom_label2 support aes(subset) via setup_data
62 62
 }
63
+\details{
64
+'geom_label2' is a modified version of geom_label, with subset aesthetic supported
65
+}
66
+\examples{
67
+library(ggtree)
68
+set.seed(123)
69
+tr<- rtree(15)
70
+x <- ggtree(tr)
71
+x + geom_label2(aes(label = node, subset = isTip == FALSE))
72
+}
73
+\references{
74
+For more detailed demonstration of this function, please refer to chapter A.4.5 of
75
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
76
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
77
+}
63 78
 \seealso{
64 79
 \link[ggplot2:geom_text]{geom_label}
65 80
 }
... ...
@@ -15,15 +15,15 @@ geom_nodelab(
15 15
 )
16 16
 }
17 17
 \arguments{
18
-\item{mapping}{aes mapping}
18
+\item{mapping}{aesthetic mappings, defaults to NULL}
19 19
 
20
-\item{nudge_x}{horizontal adjustment to nudge label}
20
+\item{nudge_x}{horizontal adjustment to nudge labels, defaults to 0}
21 21
 
22
-\item{nudge_y}{vertical adjustment to nudge label}
22
+\item{nudge_y}{vertical adjustment to nudge labels, defaults to 0}
23 23
 
24 24
 \item{geom}{one of 'text', "shadowtext", 'label', 'image' and 'phylopic'}
25 25
 
26
-\item{hjust}{horizontal alignment, one of 0, 0.5 or 1}
26
+\item{hjust}{horizontal alignment, defaults to 0.5}
27 27
 
28 28
 \item{node}{a character indicating which node labels will be displayed,
29 29
 it should be one of 'internal', 'external' and 'all'. If it is set to 'internal'
... ...
@@ -37,7 +37,12 @@ the additional parameters of \code{\link[=geom_tiplab]{geom_tiplab()}}.}
37 37
 geom layer
38 38
 }
39 39
 \description{
40
-add node label layer
40
+add node label layer for a tree
41
+}
42
+\references{
43
+For demonstration of this function, please refer to chapter A.4.5 of
44
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
45
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
41 46
 }
42 47
 \seealso{
43 48
 \code{\link[=geom_tiplab]{geom_tiplab()}}
... ...
@@ -14,15 +14,15 @@ geom_nodelab2(
14 14
 )
15 15
 }
16 16
 \arguments{
17
-\item{mapping}{aes mapping}
17
+\item{mapping}{aesthetic mappings, defaults to NULL}
18 18
 
19
-\item{nudge_x}{horizontal adjustment to nudge label}
19
+\item{nudge_x}{horizontal adjustment to nudge labels, defaults to 0}
20 20
 
21
-\item{nudge_y}{vertical adjustment to nudge label}
21
+\item{nudge_y}{vertical adjustment to nudge labels, defaults to 0}
22 22
 
23 23
 \item{geom}{one of 'text', "shadowtext", 'label', 'image' and 'phylopic'}
24 24
 
25
-\item{hjust}{horizontal alignment, one of 0, 0.5 or 1}
25
+\item{hjust}{horizontal alignment, defaults to 0.5}
26 26
 
27 27
 \item{...}{additional parameters, see also
28 28
 the additional parameters of \code{\link[=geom_tiplab]{geom_tiplab()}}.}
... ...
@@ -20,16 +20,16 @@ If \code{inherit.aes = TRUE}, the mapping can be inherited from the plot mapping
20 20
 specified in the call to \code{ggplot()}.}
21 21
 
22 22
 \item{data}{The data to be displayed in this layer. If 'NULL' (the default),
23
-the data is inherited from the plot data as specified in the call to 'ggplot()',}
23
+the data is inherited from the plot data as specified in the call to \code{ggplot()}.}
24 24
 
25 25
 \item{position}{Position adjustment.}
26 26
 
27
-\item{na.rm}{logical. If 'FALSE' (the default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
27
+\item{na.rm}{logical. If 'FALSE' (default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
28 28
 
29 29
 \item{show.legend}{logical. Should this layer be included in the legends?
30 30
 'NA', the default, includes if any aesthetics are mapped. 'FALSE' never includes, and 'TRUE' always includes.}
31 31
 
32
-\item{inherit.aes}{logical (default is 'TRUE'). If 'FALSE', overrides the default aesthetics,
32
+\item{inherit.aes}{logical (defaults to 'TRUE'). If 'FALSE', overrides the default aesthetics,
33 33
 rather then combining with them.}
34 34
 
35 35
 \item{...}{addtional parameters that passed on to this layer. These are often aesthetics, used to set an aesthetic to a fixed value, like \code{colour = "red"} or \code{size = 3}.}
... ...
@@ -38,8 +38,17 @@ rather then combining with them.}
38 38
 node point layer
39 39
 }
40 40
 \description{
41
-add node point
41
+add node point layer to a tree
42
+}
43
+\references{
44
+For more detailed demonstration, please refer to chapter 4.3.2 of
45
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
46
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
42 47
 }
43 48
 \author{
44 49
 Guangchuang Yu
50
+library(ggtree)
51
+tr<- rtree(15)
52
+x <- ggtree(tr)
53
+x + geom_nodepoint()
45 54
 }
... ...
@@ -21,18 +21,18 @@ If \code{inherit.aes = TRUE}, the mapping can be inherited from the plot mapping
21 21
 specified in the call to \code{ggplot()}.}
22 22
 
23 23
 \item{data}{The data to be displayed in this layer. If 'NULL' (the default),
24
-the data is inherited from the plot data as specified in the call to 'ggplot()',}
24
+the data is inherited from the plot data as specified in the call to \code{ggplot()}.}
25 25
 
26 26
 \item{stat}{Name of the statistical transformation to be used on the data for this layer.}
27 27
 
28 28
 \item{position}{Position adjustment.}
29 29
 
30
-\item{na.rm}{logical. If 'FALSE' (the default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
30
+\item{na.rm}{logical. If 'FALSE' (default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
31 31
 
32 32
 \item{show.legend}{logical. Should this layer be included in the legends?
33 33
 'NA', the default, includes if any aesthetics are mapped. 'FALSE' never includes, and 'TRUE' always includes.}
34 34
 
35
-\item{inherit.aes}{logical (default is 'TRUE'). If 'FALSE', overrides the default aesthetics,
35
+\item{inherit.aes}{logical (defaults to 'TRUE'). If 'FALSE', overrides the default aesthetics,
36 36
 rather then combining with them.}
37 37
 
38 38
 \item{...}{addtional parameters that passed on to this layer. These are often aesthetics, used to set an aesthetic to a fixed value, like \code{colour = "red"} or \code{size = 3}.}
... ...
@@ -51,12 +51,12 @@ geom_point2 is a modified version of geom_point that supports aes(subset)
51 51
 \code{geom_point2()} understands the following aesthetics
52 52
 \itemize{
53 53
 \item \code{subset} logical expression indicating elements or rows to keep: missing values are taken as false; should be in aes().
54
-\item \code{colour} the colour of point, default is black.
55
-\item \code{fill} the colour of fill, default is black.
56
-\item \code{alpha} the transparency of fill, default is 1.
57
-\item \code{size} the size of point, default is 1.5.
58
-\item \code{shape} specify a shape, default is 19.
59
-\item \code{stroke} control point border thickness of point, default is 0.5.
54
+\item \code{colour} the colour of point, defaults to "black".
55
+\item \code{fill} the colour of fill, defaults to "black".
56
+\item \code{alpha} the transparency of fill, defaults to 1.
57
+\item \code{size} the size of point, defaults to 1.5.
58
+\item \code{shape} specify a shape, defaults to 19.
59
+\item \code{stroke} control point border thickness of point, defaults to 0.5.
60 60
 }
61 61
 }
62 62
 
... ...
@@ -7,7 +7,7 @@
7 7
 geom_range(range, center = "auto", ...)
8 8
 }
9 9
 \arguments{
10
-\item{range}{range, e.g. "height_0.95_HPD"}
10
+\item{range}{range(interval) to be displayed, e.g. "height_0.95_HPD"}
11 11
 
12 12
 \item{center}{center of the range, mean, median or auto (default, the center of the range)}
13 13
 
... ...
@@ -17,7 +17,12 @@ geom_range(range, center = "auto", ...)
17 17
 ggplot layer
18 18
 }
19 19
 \description{
20
-bar of range (HPD, range etc) to present uncertainty of evolutionary inference
20
+horizontal bar of range (HPD, range etc) on nodes to present uncertainty of evolutionary inference
21
+}
22
+\references{
23
+For demonstration of this function, please refer to chapter 5.2.4 of
24
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
25
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
21 26
 }
22 27
 \author{
23 28
 Guangchuang Yu
... ...
@@ -7,26 +7,26 @@
7 7
 geom_rootedge(rootedge = NULL, ...)
8 8
 }
9 9
 \arguments{
10
-\item{rootedge}{length of rootedge; use phylo$root.edge if rootedge = NULL (by default).}
10
+\item{rootedge}{length of rootedge; use phylo$root.edge if rootedge = NULL (default).}
11 11
 
12 12
 \item{...}{additional parameters
13 13
 
14 14
 Additional parameters can be referred to the following parameters:
15 15
 \itemize{
16
-\item \code{size} control the width of rootedge, default is 0.5.
17
-\item \code{colour} color of rootedge, default is black.
18
-\item \code{linetype} the type of line, default is 1.
19
-\item \code{alpha} modify colour transparency, default is 1.
16
+\item \code{size} control the width of rootedge, defaults to 0.5.
17
+\item \code{colour} color of rootedge, defaults to black.
18
+\item \code{linetype} the type of line, defaults to 1.
19
+\item \code{alpha} modify colour transparency, defaults to 1.
20 20
 }}
21 21
 }
22 22
 \value{
23 23
 ggtree rootedge layer
24 24
 }
25 25
 \description{
26
-display root edge
26
+display root edge layer for a tree
27 27
 }
28 28
 \details{
29
-\code{geom_rootedge} is used to create a rootedge.
29
+\code{geom_rootedge} is used to create a rootedge as ggtree doesn’t plot the root edge by default.
30 30
 }
31 31
 \examples{
32 32
 
... ...
@@ -48,8 +48,10 @@ ggtree(tree2) + geom_tiplab() + geom_rootedge()
48 48
 ## this will ignore tree$root.edge
49 49
 ggtree(tree2) + geom_tiplab() + geom_rootedge(rootedge = 3)
50 50
 
51
-## For more information about tree visualization, please refer to the online book
52
-## https://yulab-smu.top/treedata-book/chapter4.html
51
+
52
+## For more detailed demonstration of this function, please refer to chapter A.4.5 of 
53
+## *Data Integration, Manipulation and Visualization of Phylogenetic Trees*
54
+## <http://yulab-smu.top/treedata-book/index.html> by Guangchuang Yu.
53 55
 
54 56
 }
55 57
 \references{
... ...
@@ -20,16 +20,16 @@ If \code{inherit.aes = TRUE}, the mapping can be inherited from the plot mapping
20 20
 specified in the call to \code{ggplot()}.}
21 21
 
22 22
 \item{data}{The data to be displayed in this layer. If 'NULL' (the default),
23
-the data is inherited from the plot data as specified in the call to 'ggplot()',}
23
+the data is inherited from the plot data as specified in the call to \code{ggplot()}.}
24 24
 
25 25
 \item{position}{Position adjustment.}
26 26
 
27
-\item{na.rm}{logical. If 'FALSE' (the default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
27
+\item{na.rm}{logical. If 'FALSE' (default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
28 28
 
29 29
 \item{show.legend}{logical. Should this layer be included in the legends?
30 30
 'NA', the default, includes if any aesthetics are mapped. 'FALSE' never includes, and 'TRUE' always includes.}
31 31
 
32
-\item{inherit.aes}{logical (default is 'TRUE'). If 'FALSE', overrides the default aesthetics,
32
+\item{inherit.aes}{logical (defaults to 'TRUE'). If 'FALSE', overrides the default aesthetics,
33 33
 rather then combining with them.}
34 34
 
35 35
 \item{...}{addtional parameters that passed on to this layer. These are often aesthetics, used to set an aesthetic to a fixed value, like \code{colour = "red"} or \code{size = 3}.}
... ...
@@ -38,10 +38,10 @@ rather then combining with them.}
38 38
 root point layer
39 39
 }
40 40
 \description{
41
-geom_rootpoint is used to add root point
41
+geom_rootpoint is used to add root point layer to a tree
42 42
 }
43 43
 \details{
44
-geom_rootpoint inherit from geom_point2, it is used to display and customize the points on the root
44
+geom_rootpoint inherit from geom_point2, and it is used to display and customize the points on the root
45 45
 }
46 46
 \examples{
47 47
 library(ggtree)
... ...
@@ -20,23 +20,24 @@ geom_segment2(
20 20
 )
21 21
 }
22 22
 \arguments{
23
-\item{mapping}{aes mapping}
23
+\item{mapping}{Set of aesthetic mappings, defaults to NULL}
24 24
 
25
-\item{data}{data}
25
+\item{data}{A layer specific dataset -
26
+only needed if you want to override the plot defaults.}
26 27
 
27
-\item{stat}{Name of stat to modify data}
28
+\item{stat}{Name of stat to modify data.}
28 29
 
29
-\item{position}{position}
30
+\item{position}{The position adjustment to use for overlapping points on this layer.}
30 31
 
31
-\item{lineend}{lineend}
32
+\item{lineend}{Line end style, one of butt (default), round and square.}
32 33
 
33
-\item{na.rm}{logical}
34
+\item{na.rm}{If "FALSE" (default), missing values are removed with a warning. If "TRUE", missing values are silently removed, logical.}
34 35
 
35
-\item{show.legend}{logical}
36
+\item{show.legend}{Whether to show legend, logical.}
36 37
 
37
-\item{inherit.aes}{logical}
38
+\item{inherit.aes}{Whether to inherit aesthetic mappings, logical, defaults to "TRUE".}
38 39
 
39
-\item{nudge_x}{horizontal adjustment of x}
40
+\item{nudge_x}{adjust the horizontal position of the segments.}
40 41
 
41 42
 \item{arrow}{specification for arrow heads, as created by arrow().}
42 43
 
... ...
@@ -50,6 +51,9 @@ add segment layer
50 51
 \description{
51 52
 geom_segment2 support aes(subset) via setup_data
52 53
 }
54
+\details{
55
+'geom_segment2' is a modified version of geom_segment, with subset aesthetic supported
56
+}
53 57
 \seealso{
54 58
 \link[ggplot2:geom_segment]{geom_segment}
55 59
 }
... ...
@@ -29,33 +29,34 @@ geom_strip(
29 29
 
30 30
 \item{taxa2}{taxa2}
31 31
 
32
-\item{label}{optional label}
32
+\item{label}{add label alongside the bar (optional)}
33 33
 
34 34
 \item{offset}{offset of bar and text from the clade}
35 35
 
36 36
 \item{offset.text}{offset of text from bar}
37 37
 
38
-\item{align}{logical}
38
+\item{align}{logical, whether to align bars to the most distant bar ,defaults to "TRUE"
39
+Note that if "FALSE", the bars might cross the tree}
39 40
 
40
-\item{barsize}{size of bar}
41
+\item{barsize}{set size of the bar}
41 42
 
42
-\item{extend}{extend bar vertically}
43
+\item{extend}{extend bar length vertically}
43 44
 
44
-\item{fontsize}{size of text}
45
+\item{fontsize}{set size of the text}
45 46
 
46
-\item{angle}{angle of text}
47
+\item{angle}{set the angle of text}
47 48
 
48 49
 \item{geom}{one of 'text' or 'label'}
49 50
 
50
-\item{hjust}{hjust}
51
+\item{hjust}{adjust the horizonal position of the bar}
51 52
 
52
-\item{color}{color for bar and label}
53
+\item{color}{set color for bar and label}
53 54
 
54
-\item{fill}{fill label background, only work with geom='label'}
55
+\item{fill}{set color to fill label background, only work with geom='label'}
55 56
 
56
-\item{family}{sans by default, can be any supported font}
57
+\item{family}{"sans" by default, can be any supported font}
57 58
 
58
-\item{parse}{logical, whether parse label}
59
+\item{parse}{logical, whether to parse labels, if "TRUE", the labels will be parsed into expressions, defaults to "FALSE"}
59 60
 
60 61
 \item{...}{additional parameter}
61 62
 }
... ...
@@ -65,6 +66,17 @@ ggplot layers
65 66
 \description{
66 67
 annotate associated taxa (from taxa1 to taxa2, can be Monophyletic, Polyphyletic or Paraphyletc Taxa) with bar and (optional) text label
67 68
 }
69
+\examples{
70
+library(ggtree)
71
+tr<- rtree(15)
72
+x <- ggtree(tr)
73
+x + geom_strip(13, 1, color = "red") + geom_strip(3, 7, color = "blue")
74
+}
75
+\references{
76
+For more detailed demonstration of this function, please refer to chapter 5.2.1 of
77
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
78
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
79
+}
68 80
 \author{
69 81
 Guangchuang Yu
70 82
 }
... ...
@@ -19,20 +19,23 @@ geom_tiplab(
19 19
 \arguments{
20 20
 \item{mapping}{aes mapping}
21 21
 
22
-\item{hjust}{horizontal adjustment}
22
+\item{hjust}{horizontal adjustment, defaults to 0}
23 23
 
24
-\item{align}{align tip lab or not, logical}
24
+\item{align}{if TRUE, align all tip labels to the longest tip by adding padding characters
25
+to the left side of tip labels, defaults to "FALSE"
26
+with a line connecting each tip and its corresponding label, defaults to "FALSE"}
25 27
 
26
-\item{linetype}{linetype for adding line if align = TRUE}
28
+\item{linetype}{set linetype of the line if align = TRUE, defaults to "dotted"}
27 29
 
28
-\item{linesize}{line size of line if align = TRUE}
30
+\item{linesize}{set line size of the line if align = TRUE, defaults to 0.5}
29 31
 
30 32
 \item{geom}{one of 'text', 'label', 'shadowtext', 'image' and 'phylopic'}
31 33
 
32 34
 \item{offset}{tiplab offset, horizontal
33
-adjustment to nudge tip labels, default is 0.}
35
+adjustment to nudge tip labels, defaults to 0}
34 36
 
35
-\item{as_ylab}{display tip labels as y-axis label, only works for rectangular and dendrogram layouts}
37
+\item{as_ylab}{display tip labels as y-axis label,
38
+only works for rectangular and dendrogram layouts, defaults to "FALSE"}
36 39
 
37 40
 \item{...}{additional parameter
38 41
 
... ...
@@ -40,17 +43,17 @@ additional parameters can refer the following parameters.
40 43
 
41 44
 The following parameters for geom="text".
42 45
 \itemize{
43
-\item \code{size} control the size of tip labels, default is 3.88.
44
-\item \code{colour} control the colour of tip labels, default is "black".
45
-\item \code{angle} control the angle of tip labels, default is 0.
46
-\item \code{vjust} A numeric vector specifying vertical justification, default is 0.5.
47
-\item \code{alpha} the transparency of text, default is NA.
48
-\item \code{family} the family of text, default is 'sans'.
49
-\item \code{fontface} the font face of text, default is 1 (plain), others are
46
+\item \code{size} control the size of tip labels, defaults to 3.88.
47
+\item \code{colour} control the colour of tip labels, defaults to "black".
48
+\item \code{angle} control the angle of tip labels, defaults to 0.
49
+\item \code{vjust} A numeric vector specifying vertical justification, defaults to 0.5.
50
+\item \code{alpha} the transparency of text, defaults to NA.
51
+\item \code{family} the family of text, defaults to 'sans'.
52
+\item \code{fontface} the font face of text, defaults to 1 (plain), others are
50 53
 2 (bold), 3 (italic), 4 (bold.italic).
51
-\item \code{lineheight} The height of a line as a multiple of the size of text, default is 1.2 .
52
-\item \code{nudge_x} horizontal adjustment to nudge labels, default is 0.
53
-\item \code{nudge_y}  vertical adjustment to nudge labels, default is 0.
54
+\item \code{lineheight} The height of a line as a multiple of the size of text, defaults to 1.2 .
55
+\item \code{nudge_x} horizontal adjustment to nudge labels, defaults to 0.
56
+\item \code{nudge_y}  vertical adjustment to nudge labels, defaults to 0.
54 57
 \item \code{check.overlap} if TRUE, text that overlaps previous text in the same layer
55 58
 will not be plotted.
56 59
 \item \code{parse} if TRUE, the labels will be parsed into expressions, if it is 'emoji', the labels
... ...
@@ -59,62 +62,75 @@ will be parsed into emojifont.
59 62
 
60 63
 The following parameters for geom="label".
61 64
 \itemize{
62
-\item \code{size} the size of tip labels, default is 3.88.
63
-\item \code{colour} the colour of tip labels, default is "black".
64
-\item \code{fill} the colour of rectangular box of labels, default is "white".
65
-\item \code{vjust} numeric vector specifying vertical justification, default is 0.5.
66
-\item \code{alpha} the transparency of labels, default is NA.
67
-\item \code{family} the family of text, default is 'sans'.
68
-\item \code{fontface} the font face of text, default is 1 (plain), others are
65
+\item \code{size} the size of tip labels, defaults to 3.88.
66
+\item \code{colour} the colour of tip labels, defaults to "black".
67
+\item \code{fill} the colour of rectangular box of labels, defaults to "white".
68
+\item \code{vjust} numeric vector specifying vertical justification, defaults to 0.5.
69
+\item \code{alpha} the transparency of labels, defaults to NA.
70
+\item \code{family} the family of text, defaults to 'sans'.
71
+\item \code{fontface} the font face of text, defaults to 1 (plain), others are
69 72
 2 (bold), 3 (italic), 4 (bold.italic).
70
-\item \code{lineheight} The height of a line as a multiple of the size of text, default is 1.2.
71
-\item \code{nudge_x} horizontal adjustment to nudge labels, default is 0.
72
-\item \code{nudge_y}  vertical adjustment, default is 0.
73
+\item \code{lineheight} The height of a line as a multiple of the size of text, defaults to 1.2.
74
+\item \code{nudge_x} horizontal adjustment to nudge labels, defaults to 0.
75
+\item \code{nudge_y}  vertical adjustment, defaults to 0.
73 76
 \item \code{check.overlap} if TRUE, text that overlaps previous text in the same layer
74 77
 will not be plotted.
75 78
 \item \code{parse} if TRUE, the labels will be parsed into expressions, if it is 'emoji', the labels
76 79
 will be parsed into emojifont.
77
-\item \code{label.padding} Amount of padding around label, default is 'unit(0.25, "lines")'.
78
-\item \code{label.r} Radius of rounded corners, default is 'unit(0.15, "lines")'.
79
-\item \code{label.size} Size of label border, in mm, default is 0.25.
80
+\item \code{label.padding} Amount of padding around label, defaults to 'unit(0.25, "lines")'.
81
+\item \code{label.r} Radius of rounded corners, defaults to 'unit(0.15, "lines")'.
82
+\item \code{label.size} Size of label border, in mm, defaults to 0.25.
80 83
 }
81 84
 
82 85
 The following parameters for geom="shadowtext", some parameters are like to geom="text".
83 86
 \itemize{
84
-\item \code{bg.colour} the background colour of text, default is "black".
85
-\item \code{bg.r} the width of background of text, default is 0.1 .
87
+\item \code{bg.colour} the background colour of text, defaults to "black".
88
+\item \code{bg.r} the width of background of text, defaults to 0.1 .
86 89
 }
87 90
 
88 91
 The following parameters for geom="image" or geom="phylopic".
89 92
 \itemize{
90 93
 \item \code{image} the image file path for geom='image', but when geom='phylopic',
91 94
 it should be the uid of phylopic databases.
92
-\item \code{size} the image size, default is 0.05.
93
-\item \code{colour} the color of image, default is NULL.
94
-\item \code{alpha} the transparency of image, default is 0.8.
95
+\item \code{size} the image size, defaults to 0.05.
96
+\item \code{colour} the color of image, defaults to NULL.
97
+\item \code{alpha} the transparency of image, defaults to 0.8.
95 98
 }
96 99
 
97 100
 The following parameters for the line when align = TRUE.
98 101
 \itemize{
99
-\item \code{colour} the colour of line, default is 'black'.
100
-\item \code{alpha} the transparency of line, default is NA.
102
+\item \code{colour} the colour of line, defaults to 'black'.
103
+\item \code{alpha} the transparency of line, defaults to NA.
101 104
 \item \code{arrow} specification for arrow heads,
102
-as created by arrow(), default is NULL.
105
+as created by arrow(), defaults to NULL.
103 106
 \item \code{arrow.fill} fill color to usse for the arrow head (if closed),
104
-default is 'NULL', meaning use 'colour' aesthetic.
107
+defaults to 'NULL', meaning use 'colour' aesthetic.
105 108
 }}
106 109
 }
107 110
 \value{
108 111
 tip label layer
109 112
 }
110 113
 \description{
111
-add tip label layer
114
+add tip label layer for a tree
115
+}
116
+\details{
117
+'geom_tiplab' not only supports using text or label geom to display tip labels,
118
+but also supports image geom to label tip with image files or phylopics.
119
+
120
+For adding tip labels to a tree with circular layout, 'geom_tiplab' will
121
+automatically adjust the angle of the tip labels to the tree by
122
+internally calling 'geom_tiplab2'.
112 123
 }
113 124
 \examples{
114 125
 require(ape)
115 126
 tr <- rtree(10)
116 127
 ggtree(tr) + geom_tiplab()
117 128
 }
129
+\references{
130
+For more detailed demonstration, please refer to chapter 4.3.3 of
131
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
132
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
133
+}
118 134
 \author{
119 135
 Guangchuang Yu
120 136
 }
... ...
@@ -9,7 +9,7 @@ geom_tiplab2(mapping = NULL, hjust = 0, ...)
9 9
 \arguments{
10 10
 \item{mapping}{aes mapping}
11 11
 
12
-\item{hjust}{horizontal adjustment}
12
+\item{hjust}{horizontal adjustment, defaults to 0}
13 13
 
14 14
 \item{...}{additional parameter, see geom_tiplab}
15 15
 }
... ...
@@ -19,6 +19,16 @@ tip label layer
19 19
 \description{
20 20
 add tip label for circular layout
21 21
 }
22
+\details{
23
+'geom_tiplab2' will automatically adjust the angle of the tip labels
24
+to the tree with circular layout
25
+}
26
+\examples{
27
+library(ggtree)
28
+set.seed(123)
29
+tr <- rtree(10)
30
+ggtree(tr, layout = "circular") + geom_tiplab2()
31
+}
22 32
 \references{
23 33
 \url{https://groups.google.com/forum/#!topic/bioc-ggtree/o35PV3iHO-0}
24 34
 }
... ...
@@ -20,16 +20,16 @@ If \code{inherit.aes = TRUE}, the mapping can be inherited from the plot mapping
20 20
 specified in the call to \code{ggplot()}.}
21 21
 
22 22
 \item{data}{The data to be displayed in this layer. If 'NULL' (the default),
23
-the data is inherited from the plot data as specified in the call to 'ggplot()',}
23
+the data is inherited from the plot data as specified in the call to \code{ggplot()}.}
24 24
 
25 25
 \item{position}{Position adjustment.}
26 26
 
27
-\item{na.rm}{logical. If 'FALSE' (the default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
27
+\item{na.rm}{logical. If 'FALSE' (default), missing values are removed with a warning. If 'TRUE', missing values are silently removed.}
28 28
 
29 29
 \item{show.legend}{logical. Should this layer be included in the legends?
30 30
 'NA', the default, includes if any aesthetics are mapped. 'FALSE' never includes, and 'TRUE' always includes.}
31 31
 
32
-\item{inherit.aes}{logical (default is 'TRUE'). If 'FALSE', overrides the default aesthetics,
32
+\item{inherit.aes}{logical (defaults to 'TRUE'). If 'FALSE', overrides the default aesthetics,
33 33
 rather then combining with them.}
34 34
 
35 35
 \item{...}{addtional parameters that passed on to this layer. These are often aesthetics, used to set an aesthetic to a fixed value, like \code{colour = "red"} or \code{size = 3}.}
... ...
@@ -38,7 +38,18 @@ rather then combining with them.}
38 38
 tip point layer
39 39
 }
40 40
 \description{
41
-add tip point
41
+add tip point layer for a tree
42
+}
43
+\examples{
44
+library(ggtree)
45
+tr<- rtree(15)
46
+x <- ggtree(tr)
47
+x + geom_tippoint()
48
+}
49
+\references{
50
+For more detailed demonstration, please refer to chapter 4.3.2 of
51
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
52
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
42 53
 }
43 54
 \author{
44 55
 Guangchuang Yu
... ...
@@ -17,12 +17,12 @@ geom_tree(
17 17
 \arguments{
18 18
 \item{mapping}{aesthetic mapping}
19 19
 
20
-\item{data}{data}
20
+\item{data}{data of the tree}
21 21
 
22 22
 \item{layout}{one of 'rectangular', 'dendrogram', 'slanted', 'ellipse', 'roundrect',
23 23
 'fan', 'circular', 'inward_circular', 'radial', 'equal_angle', 'daylight' or 'ape'}
24 24
 
25
-\item{multiPhylo}{logical, whether input data contains multiple phylo class.}
25
+\item{multiPhylo}{logical, whether input data contains multiple phylo class, defaults to "FALSE".}
26 26
 
27 27
 \item{continuous}{character, continuous transition for selected aesthethic ('size'
28 28
 or 'color'('colour')). It should be one of 'color' (or 'colour'), 'size', 'all'
... ...
@@ -54,6 +54,15 @@ add tree layer
54 54
 }
55 55
 }
56 56
 
57
+\examples{
58
+tree <- rtree(10)
59
+ggplot(tree) + geom_tree()
60
+}
61
+\references{
62
+For demonstration of this function, please refer to chapter 4.2.1 of
63
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
64
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
65
+}
57 66
 \author{
58 67
 Yu Guangchuang
59 68
 }
... ...
@@ -18,31 +18,39 @@ geom_treescale(
18 18
 )
19 19
 }
20 20
 \arguments{
21
-\item{x}{x position}
21
+\item{x}{set x position of the scale}
22 22
 
23
-\item{y}{y position}
23
+\item{y}{set y position of the scale}
24 24
 
25
-\item{width}{width of scale}
25
+\item{width}{set the length of the tree scale}
26 26
 
27
-\item{offset}{offset of text to line}
27
+\item{offset}{set offset of text to line, defaults to NULL}
28 28
 
29
-\item{offset.label}{offset of scale title to line.}
29
+\item{offset.label}{set offset of the scale title to line.}
30 30
 
31
-\item{label}{the title of tree scale, default is NULL.}
31
+\item{label}{set the title of tree scale, defaults to NULL.}
32 32
 
33
-\item{color}{color}
33
+\item{color}{set color of the scale}
34 34
 
35
-\item{linesize}{size of line}
35
+\item{linesize}{set size of line}
36 36
 
37
-\item{fontsize}{size of text}
37
+\item{fontsize}{set size of text}
38 38
 
39
-\item{family}{sans by default, can be any supported font}
39
+\item{family}{'sans' by default, can be any supported font}
40 40
 }
41 41
 \value{
42 42
 ggplot layers
43 43
 }
44 44
 \description{
45
-add tree scale
45
+add tree scale to a tree
46
+}
47
+\details{
48
+'geom_treescale' automatically adds a scale bar for evolutionary distance
49
+}
50
+\references{
51
+For demonstration of this function, please refer to chapter 4.3.1 of
52
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
53
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
46 54
 }
47 55
 \author{
48 56
 Guangchuang Yu
... ...
@@ -7,10 +7,10 @@
7 7
 geom_zoom_clade(node, xexpand = NULL)
8 8
 }
9 9
 \arguments{
10
-\item{node}{internal node number}
10
+\item{node}{internal node number to zoom in its corresponding clade}
11 11
 
12
-\item{xexpand}{numeric, extend x, meaning the ratio of range of original x,
13
-default is NULL.}
12
+\item{xexpand}{numeric, extend x, meaning the ratio of range of the xlim of the original tree,
13
+defaults to NULL.}
14 14
 }
15 15
 \value{
16 16
 updated tree view
... ...
@@ -18,6 +18,10 @@ updated tree view
18 18
 \description{
19 19
 zoom selected clade of a tree
20 20
 }
21
+\details{
22
+'geom_zoom_clade' zooms in on a selected clade of a tree,
23
+while showing its on the full view of tree as a seperated panel for reference
24
+}
21 25
 \author{
22 26
 Guangchuang Yu
23 27
 }
... ...
@@ -7,7 +7,7 @@
7 7
 get_taxa_name(tree_view = NULL, node = NULL)
8 8
 }
9 9
 \arguments{
10
-\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot will be used.}
10
+\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot object will be used.}
11 11
 
12 12
 \item{node}{internal node number to specify a clade. If NULL, using the whole tree}
13 13
 }
... ...
@@ -23,7 +23,7 @@ ggdensitree(
23 23
 
24 24
 \item{tip.order}{the order of the tips by a character vector of taxa names; or an integer, N, to order the tips by the order of the tips in the Nth tree; 'mode' to order the tips by the most common order; 'mds' to order the tips based on MDS of the path length between the tips;  or 'mds_dist' to order the tips based on MDS of the distance between the tips (default: 'mode')}
25 25
 
26
-\item{align.tips}{TRUE to align trees by their tips and FALSE to align trees by their root (default: TRUE)}
26
+\item{align.tips}{TRUE (default) to align trees by their tips and FALSE to align trees by their root}
27 27
 
28 28
 \item{jitter}{deviation to jitter tips}
29 29
 
... ...
@@ -35,6 +35,10 @@ tree layer
35 35
 \description{
36 36
 drawing phylogenetic trees from list of phylo objects
37 37
 }
38
+\details{
39
+The trees plotted by 'ggdensitree()' will be stacked on top of each other and the
40
+structures of the trees will be rotated to ensure the consistency of the tip order.
41
+}
38 42
 \examples{
39 43
 require(ape)
40 44
 require(dplyr)
... ...
@@ -74,6 +78,11 @@ otu.trees <- lapply(example.trees, groupOTU, grp)
74 78
 # Plot multiple trees colored by OTU
75 79
 ggdensitree(otu.trees, aes(colour=group), alpha=1/6, tip.order='mds') + scale_colour_manual(values=c("black", "red", "green", "blue"))
76 80
 }
81
+\references{
82
+For more detailed demonstration of this function, please refer to chapter 4.4.2 of
83
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
84
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
85
+}
77 86
 \author{
78 87
 Yu Guangchuang, Bradley R. Jones
79 88
 }
... ...
@@ -13,11 +13,11 @@ vexpand(ratio, direction = 1)
13 13
 ggexpand(ratio, direction = 1, side = "hv")
14 14
 }
15 15
 \arguments{
16
-\item{ratio}{expand x (y) limits by amount of xrange (yrange) * ratio}
16
+\item{ratio}{expand x (y) axis limits by amount of xrange (yrange) * ratio}
17 17
 
18
-\item{direction}{expand x limit at right hand side if direction is 1, or left hand side if direction is -1}
18
+\item{direction}{expand x axis limit at right hand side if direction is 1 (default), or left hand side if direction is -1}
19 19
 
20
-\item{side}{one of 'h' for horizontal and 'v' for vertical or 'hv' for both.}
20
+\item{side}{one of 'h' for horizontal and 'v' for vertical or 'hv' for both (default).}
21 21
 }
22 22
 \value{
23 23
 ggexpand object
... ...
@@ -27,7 +27,13 @@ hexpand
27 27
 
28 28
 vexpand
29 29
 
30
-expand xlim (ylim) by ratio of x (y) range
30
+expand xlim (ylim) by ratio of x (y) axis range
31
+}
32
+\examples{
33
+x <- rtree(20)
34
+x$tip.label <- paste0('RRRRREEEEEAAAAALLLLLYYYYY_Long_Lable_', x$tip.label)
35
+p1 <- ggtree(x) + geom_tiplab()
36
+p1 + ggexpand(1.5, side = "h")
31 37
 }
32 38
 \author{
33 39
 Guangchuang Yu
... ...
@@ -90,6 +90,10 @@ visualization and annotation of phylogenetic trees with their covariates and
90 90
 other associated data. Methods in Ecology and Evolution, 8(1):28-36.
91 91
 \url{https://doi.org/10.1111/2041-210X.12628}
92 92
 }
93
+
94
+For more information, please refer to
95
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
96
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
93 97
 }
94 98
 \seealso{
95 99
 \code{\link[=geom_tree]{geom_tree()}}
... ...
@@ -30,43 +30,50 @@ gheatmap(
30 30
 
31 31
 \item{data}{matrix or data.frame}
32 32
 
33
-\item{offset}{offset of heatmap to tree}
33
+\item{offset}{set offset of the heatmap to tree}
34 34
 
35
-\item{width}{total width of heatmap, compare to width of tree}
35
+\item{width}{total width of heatmap, compare to width of tree, defaults to 1,
36
+which means they are of the same length}
36 37
 
37
-\item{low}{color of lowest value}
38
+\item{low}{set color of the lowest value, defaults to "green"}
38 39
 
39
-\item{high}{color of highest value}
40
+\item{high}{set color of the highest value, defaults to "red"}
40 41
 
41
-\item{color}{color of heatmap cell border}
42
+\item{color}{set color of heatmap cell border, defaults to "white"}
42 43
 
43
-\item{colnames}{logical, add matrix colnames or not}
44
+\item{colnames}{logical, whether to add matrix colnames, defaults to "TRUE"}
44 45
 
45
-\item{colnames_position}{one of 'bottom' or 'top'}
46
+\item{colnames_position}{set the position of the colnames, one of 'bottom' (default) or 'top'}
46 47
 
47
-\item{colnames_angle}{angle of column names}
48
+\item{colnames_angle}{set the angle of colnames}
48 49
 
49
-\item{colnames_level}{levels of colnames}
50
+\item{colnames_level}{set levels of colnames}
50 51
 
51
-\item{colnames_offset_x}{x offset for column names}
52
+\item{colnames_offset_x}{set x offset for colnames}
52 53
 
53
-\item{colnames_offset_y}{y offset for column names}
54
+\item{colnames_offset_y}{set y offset for colnames}
54 55
 
55
-\item{font.size}{font size of matrix colnames}
56
+\item{font.size}{set font size of matrix colnames}
56 57
 
57
-\item{family}{font of matrix colnames}
58
+\item{family}{font of matrix colnames, can be any supported font}
58 59
 
59
-\item{hjust}{hjust for column names (0: align left, 0.5: align center, 1: align righ)}
60
+\item{hjust}{adjust horizonal position of column names (0: align left, 0.5: align center (default), 1: align righ)}
60 61
 
61 62
 \item{legend_title}{title of fill legend}
62 63
 
63
-\item{custom_column_labels}{instead of the column names from a matrix, input a custom vector of column labels}
64
+\item{custom_column_labels}{instead of using the colnames from the input matrix/data.frame,
65
+input a custom vector to be set as column labels}
64 66
 }
65 67
 \value{
66 68
 tree view
67 69
 }
68 70
 \description{
69
-append a heatmap of a matrix to right side of phylogenetic tree
71
+append a heatmap of a matrix to the right side of a phylogenetic tree
72
+}
73
+\references{
74
+For demonstration of this function, please refer to chapter 7.3 of
75
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
76
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
70 77
 }
71 78
 \author{
72 79
 Guangchuang Yu
... ...
@@ -31,19 +31,19 @@ inset(
31 31
 \arguments{
32 32
 \item{insets}{a list of ggplot objects, named by node number}
33 33
 
34
-\item{width}{width of inset, relative to the range of x-axis}
34
+\item{width}{width of the inset, relative to the range of x-axis, defaults to .1}
35 35
 
36
-\item{height}{height of inset, relative to the range of y-axis}
36
+\item{height}{height of the inset, relative to the range of y-axis, defaults to .1}
37 37
 
38
-\item{hjust}{horizontal adjustment}
38
+\item{hjust}{adjust the horizontal position of the charts, charts will go left if hjust > 0}
39 39
 
40
-\item{vjust}{vertical adjustment}
40
+\item{vjust}{adjust the vertical position of the charts, charts will go down if vjust > 0}
41 41
 
42
-\item{x}{x position, one of 'node' and 'branch'}
42
+\item{x}{the position where users want to place the charts, one of 'node' (default) and 'branch'}
43 43
 
44
-\item{reverse_x}{whether x axis was reversed by scale_x_reverse}
44
+\item{reverse_x}{whether to reverse x axis of the charts by 'ggplot2::scale_x_reverse', defaults to 'FALSE'}
45 45
 
46
-\item{reverse_y}{whether y axis was reversed by scale_y_reverse}
46
+\item{reverse_y}{whether to reverse y axis of the charts by 'ggplot2::scale_y_reverse', defaults to 'FALSE'}
47 47
 
48 48
 \item{tree_view}{tree view}
49 49
 }
... ...
@@ -53,9 +53,19 @@ inset layer
53 53
 tree view with insets
54 54
 }
55 55
 \description{
56
-add subplots to tree
56
+gemo_inset can add subplots to tree by accepting a list of ggplot objects that are ancestral
57
+stats or data associated with selected nodes in the tree. These ggplot objects can be any
58
+kind of charts or hybrid of of these charts.
57 59
 
58
-add insets in a tree
60
+add subplots as insets in a tree
61
+}
62
+\details{
63
+Users can also use
64
+}
65
+\references{
66
+For demonstration of this function, please refer to chapter 8.3 of
67
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
68
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
59 69
 }
60 70
 \author{
61 71
 Guangchuang Yu
... ...
@@ -9,15 +9,15 @@ label_pad(label, justify = "right", pad = "·")
9 9
 \arguments{
10 10
 \item{label}{taxa label}
11 11
 
12
-\item{justify}{should a character vector be left-justified, right-justified (default), centred or left alone.}
12
+\item{justify}{should a character vector be right-justified (default), left-justified, centred or left alone.}
13 13
 
14
-\item{pad}{padding character (default is a dot)}
14
+\item{pad}{padding character (defaults to dots)}
15 15
 }
16 16
 \value{
17 17
 Taxa labels with padding characters added
18 18
 }
19 19
 \description{
20
-This function add padding character to the left side of taxa labels.
20
+This function adds padding characters to the left side of taxa labels, adjust their length to the longest label.
21 21
 }
22 22
 \examples{
23 23
 library(ggtree)
... ...
@@ -18,25 +18,31 @@ msaplot(
18 18
 \arguments{
19 19
 \item{p}{tree view}
20 20
 
21
-\item{fasta}{fasta file, multiple sequence alignment}
21
+\item{fasta}{fasta file that contains multiple sequence alignment information}
22 22
 
23
-\item{offset}{offset of MSA to tree}
23
+\item{offset}{set the offset of MSA to tree}
24 24
 
25
-\item{width}{total width of alignment, compare to width of tree}
25
+\item{width}{total width of alignment, compare to width of tree, defaults to 1,
26
+which means they are of the same length}
26 27
 
27
-\item{color}{color}
28
+\item{color}{set color of the tree}
28 29
 
29
-\item{window}{specific a slice to display}
30
+\item{window}{specific a slice of alignment to display}
30 31
 
31
-\item{bg_line}{whether add background line in alignment}
32
+\item{bg_line}{whether to add background line in alignment, defaults to "TRUE"}
32 33
 
33
-\item{height}{height ratio of sequence}
34
+\item{height}{height ratio of sequence, defaults to 0.8}
34 35
 }
35 36
 \value{
36 37
 tree view
37 38
 }
38 39
 \description{
39
-multiple sequence alignment with phylogenetic tree
40
+visualize phylogenetic tree with multiple sequence alignment
41
+}
42
+\references{
43
+For demonstration of this function, please refer to chapter 7.4 of
44
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
45
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
40 46
 }
41 47
 \author{
42 48
 Guangchuang Yu
... ...
@@ -18,13 +18,13 @@ multiplot(
18 18
 
19 19
 \item{plotlist}{plot list}
20 20
 
21
-\item{ncol}{number of column}
21
+\item{ncol}{set the number of column to display the plots}
22 22
 
23
-\item{widths}{widths of plots}
23
+\item{widths}{the width of each plot}
24 24
 
25
-\item{labels}{labels for labeling the plots}
25
+\item{labels}{set labels for labeling the plots}
26 26
 
27
-\item{label_size}{font size of label}
27
+\item{label_size}{set font size of the label}
28 28
 }
29 29
 \value{
30 30
 plot
... ...
@@ -7,15 +7,15 @@
7 7
 nodebar(data, cols, color, alpha = 1, position = "stack")
8 8
 }
9 9
 \arguments{
10
-\item{data}{a data.frame of stats with an additional column of node number}
10
+\item{data}{a data.frame of stats with an additional column of node number named "node"}
11 11
 
12
-\item{cols}{column of stats}
12
+\item{cols}{columns of the data.frame that store the stats}
13 13
 
14
-\item{color}{color of bar}
14
+\item{color}{set color of bars}
15 15
 
16
-\item{alpha}{alpha}
16
+\item{alpha}{set transparency of the charts}
17 17
 
18
-\item{position}{position of bar, one of 'stack' and 'dodge'}
18
+\item{position}{position of bars, if 'stack' (default) make bars stacked atop one another, 'dodge' make them dodged side-to-side}
19 19
 }
20 20
 \value{
21 21
 list of ggplot objects
... ...
@@ -7,13 +7,13 @@
7 7
 nodepie(data, cols, color, alpha = 1)
8 8
 }
9 9
 \arguments{
10
-\item{data}{a data.frame of stats with an additional column of node number}
10
+\item{data}{a data.frame of stats with an additional column of node number named "node"}
11 11
 
12
-\item{cols}{column of stats}
12
+\item{cols}{columns of the data.frame that store the stats}
13 13
 
14
-\item{color}{color of bar}
14
+\item{color}{set color of bars}
15 15
 
16
-\item{alpha}{alpha}
16
+\item{alpha}{set transparency of the charts}
17 17
 }
18 18
 \value{
19 19
 list of ggplot objects
... ...
@@ -7,15 +7,21 @@
7 7
 open_tree(treeview, angle)
8 8
 }
9 9
 \arguments{
10
-\item{treeview}{tree view}
10
+\item{treeview}{tree view in rectangular/circular layout}
11 11
 
12
-\item{angle}{angle}
12
+\item{angle}{open the tree at a specific angle}
13 13
 }
14 14
 \value{
15 15
 updated tree view
16 16
 }
17 17
 \description{
18
-open tree with specific angle
18
+transform a tree in either rectangular or circular layout into the fan layout
19
+that opens with a specific angle
20
+}
21
+\examples{
22
+tree <- rtree(15)
23
+p <- ggtree(tree) + geom_tiplab()
24
+open_tree(p, 180)
19 25
 }
20 26
 \author{
21 27
 Guangchuang Yu
... ...
@@ -25,9 +25,11 @@
25 25
 \alias{scale_colour_manual}
26 26
 \alias{scale_color_manual}
27 27
 \alias{scale_fill_manual}
28
+\alias{scale_x_continuous}
28 29
 \alias{margin}
29 30
 \alias{arrow}
30 31
 \alias{unit}
32
+\alias{plot_list}
31 33
 \title{Objects exported from other packages}
32 34
 \keyword{internal}
33 35
 \description{
... ...
@@ -37,9 +39,11 @@ below to see their documentation.
37 39
 \describe{
38 40
   \item{ape}{\code{\link[ape]{read.tree}}, \code{\link[ape]{rtree}}}
39 41
 
42
+  \item{aplot}{\code{\link[aplot]{plot_list}}}
43
+
40 44
   \item{dplyr}{\code{\link[dplyr:compute]{collapse}}}
41 45
 
42
-  \item{ggplot2}{\code{\link[ggplot2]{aes}}, \code{\link[ggplot2]{fortify}}, \code{\link[ggplot2:geom_text]{geom_label}}, \code{\link[ggplot2]{geom_point}}, \code{\link[ggplot2]{geom_text}}, \code{\link[ggplot2]{ggplot}}, \code{\link[ggplot2]{ggsave}}, \code{\link[ggplot2]{guide_legend}}, \code{\link[ggplot2:element]{margin}}, \code{\link[ggplot2:scale_manual]{scale_color_manual}}, \code{\link[ggplot2:scale_manual]{scale_colour_manual}}, \code{\link[ggplot2:scale_manual]{scale_fill_manual}}, \code{\link[ggplot2]{theme}}, \code{\link[ggplot2:lims]{xlim}}}
46
+  \item{ggplot2}{\code{\link[ggplot2]{aes}}, \code{\link[ggplot2]{fortify}}, \code{\link[ggplot2:geom_text]{geom_label}}, \code{\link[ggplot2]{geom_point}}, \code{\link[ggplot2]{geom_text}}, \code{\link[ggplot2]{ggplot}}, \code{\link[ggplot2]{ggsave}}, \code{\link[ggplot2]{guide_legend}}, \code{\link[ggplot2:element]{margin}}, \code{\link[ggplot2:scale_manual]{scale_color_manual}}, \code{\link[ggplot2:scale_manual]{scale_colour_manual}}, \code{\link[ggplot2:scale_manual]{scale_fill_manual}}, \code{\link[ggplot2:scale_continuous]{scale_x_continuous}}, \code{\link[ggplot2]{theme}}, \code{\link[ggplot2:lims]{xlim}}}
43 47
 
44 48
   \item{grid}{\code{\link[grid]{arrow}}, \code{\link[grid]{unit}}}
45 49
 
... ...
@@ -7,13 +7,22 @@
7 7
 revts(treeview)
8 8
 }
9 9
 \arguments{
10
-\item{treeview}{treeview}
10
+\item{treeview}{original tree view}
11 11
 }
12 12
 \value{
13
-updated treeview
13
+updated tree view
14 14
 }
15 15
 \description{
16
-reverse timescle x-axis
16
+reverse timescle x-axis by setting the most recent tip to 0
17
+}
18
+\details{
19
+'scale_x_continuous(labels=abs)' is required if users want to set the x-axis lable to absolute value
20
+}
21
+\examples{
22
+tr <- rtree(10)
23
+p <- ggtree(tr) + theme_tree2()
24
+p2 <- revts(p) 
25
+p2 + scale_x_continuous(labels=abs)
17 26
 }
18 27
 \author{
19 28
 Guangchuang Yu
... ...
@@ -7,7 +7,7 @@
7 7
 rotate(tree_view = NULL, node)
8 8
 }
9 9
 \arguments{
10
-\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot will be used.}
10
+\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot object will be used.}
11 11
 
12 12
 \item{node}{internal node number to specify a clade. If NULL, using the whole tree}
13 13
 }
... ...
@@ -15,7 +15,12 @@ rotate(tree_view = NULL, node)
15 15
 ggplot2 object
16 16
 }
17 17
 \description{
18
-rotate 180 degree of a selected branch
18
+rotate selected clade by 180 degree
19
+}
20
+\examples{
21
+x <- rtree(15)
22
+p <- ggtree(x) + geom_tiplab()
23
+rotate(p, 17)
19 24
 }
20 25
 \author{
21 26
 Guangchuang Yu
... ...
@@ -7,15 +7,21 @@
7 7
 rotate_tree(treeview, angle)
8 8
 }
9 9
 \arguments{
10
-\item{treeview}{tree view}
10
+\item{treeview}{tree view in circular layout}
11 11
 
12
-\item{angle}{angle}
12
+\item{angle}{the angle of rotation}
13 13
 }
14 14
 \value{
15 15
 updated tree view
16 16
 }
17 17
 \description{
18
-rotate circular tree
18
+rotate circular tree in a certain angle
19
+}
20
+\examples{
21
+tree <- rtree(15)
22
+p <- ggtree(tree) + geom_tiplab()
23
+p2 <- open_tree(p, 180)
24
+rotate_tree(p2, 180)
19 25
 }
20 26
 \author{
21 27
 Guangchuang Yu
... ...
@@ -7,21 +7,27 @@
7 7
 scaleClade(tree_view = NULL, node, scale = 1, vertical_only = TRUE)
8 8
 }
9 9
 \arguments{
10
-\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot will be used.}
10
+\item{tree_view}{tree view (i.e. the ggtree object). If tree_view is NULL, the last ggplot object will be used.}
11 11
 
12 12
 \item{node}{internal node number to specify a clade. If NULL, using the whole tree}
13 13
 
14
-\item{scale}{scale}
14
+\item{scale}{the scale of the selected clade. The clade will be zoom in when scale > 1,
15
+and will be zoom out when scale < 1}
15 16
 
16
-\item{vertical_only}{logical. If TRUE, only vertical will be scaled.
17
-If FALSE, the clade will be scaled vertical and horizontally.
18
-TRUE by default.}
17
+\item{vertical_only}{logical. If TRUE (default), only vertical will be scaled.
18
+If FALSE, the clade will be scaled vertical and horizontally.}
19 19
 }
20 20
 \value{
21 21
 tree view
22 22
 }
23 23
 \description{
24
-scale clade
24
+zoom out/in a selected clade to emphasize or de-emphasize it
25
+}
26
+\examples{
27
+x <- rtree(15)
28
+p <- ggtree(x) + geom_tiplab() +
29
+  geom_nodelab(aes(subset=!isTip, label=node), hjust = -.1, color = "red")
30
+scaleClade(p, 24, scale = .1)
25 31
 }
26 32
 \author{
27 33
 Guangchuang Yu
... ...
@@ -7,7 +7,7 @@
7 7
 scale_x_ggtree(breaks = waiver(), labels = waiver())
8 8
 }
9 9
 \arguments{
10
-\item{breaks}{breaks for tree}
10
+\item{breaks}{set breaks for tree}
11 11
 
12 12
 \item{labels}{lables for corresponding breaks}
13 13
 }
... ...
@@ -17,6 +17,15 @@ updated tree view
17 17
 \description{
18 18
 scale x for tree with gheatmap
19 19
 }
20
+\details{
21
+Since setting x-axis for tree with gheatmap by using 'theme_tree2()' is quite tricky,
22
+'scale_x_ggtree' can help set the x-axis more reasonably.
23
+}
24
+\references{
25
+For more detailed demonstration of this function, please refer to chapter 7.3 of
26
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
27
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
28
+}
20 29
 \author{
21 30
 Guangchuang Yu
22 31
 }
... ...
@@ -12,6 +12,14 @@ ggtree object
12 12
 \description{
13 13
 add second x-axis for geom_range
14 14
 }
15
+\details{
16
+notice that the first axis is disabled in the default theme thus users need to enable it first before using scale_x_range
17
+}
18
+\references{
19
+For demonstration of this function ,please refer to chapter 5.2.4 of
20
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
21
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
22
+}
15 23
 \author{
16 24
 Guangchuang Yu
17 25
 }
... ...
@@ -9,7 +9,7 @@ td_filter(..., .f = NULL)
9 9
 \arguments{
10 10
 \item{...}{Expressions that return a logical value.}
11 11
 
12
-\item{.f}{a function (if any, default is NULL) that pre-operate the data}
12
+\item{.f}{a function (if any, defaults to NULL) that pre-operate the data}
13 13
 }
14 14
 \value{
15 15
 A function to filter ggtree plot data using conditions defined by '...'.
... ...
@@ -27,6 +27,11 @@ tree <- rtree(30)
27 27
 ## similar to 'ggtree(tree) + geom_tippoint()'
28 28
 ggtree(tree) + geom_point(data = td_filter(isTip))
29 29
 }
30
+\references{
31
+For more detailed demonstration of this function, please refer to chapter 12.5.1 of
32
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
33
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
34
+}
30 35
 \seealso{
31 36
 \link[dplyr:filter]{filter}
32 37
 }
... ...
@@ -9,7 +9,7 @@ td_mutate(..., .f = NULL)
9 9
 \arguments{
10 10
 \item{...}{additional parameters that pass to dplyr::mutate}
11 11
 
12
-\item{.f}{a function (if any, default is NULL) that pre-operate the data}
12
+\item{.f}{a function (if any, defaults to NULL) that pre-operate the data}
13 13
 }
14 14
 \value{
15 15
 A function to mutate ggtree plot data
... ...
@@ -11,7 +11,7 @@ td_unnest(cols, ..., .f = NULL)
11 11
 
12 12
 \item{...}{additional parameters that pass to tidyr::unnest}
13 13
 
14
-\item{.f}{a function (if any, default is NULL) that pre-operate the data}
14
+\item{.f}{a function (if any, defaults to NULL) that pre-operate the data}
15 15
 }
16 16
 \value{
17 17
 A function to unnest ggtree plot data
... ...
@@ -24,6 +24,11 @@ The 'td_unnest' function returns another function that can be
24 24
 used to unnest ggtree() plot data. The function can be passed to
25 25
 the 'data' parameter of a geom layer to flattern list-cloumn tree data.
26 26
 }
27
+\references{
28
+For demonstration of this function, please refer to chapter 12.5.2 of
29
+\emph{Data Integration, Manipulation and Visualization of Phylogenetic Trees}
30
+\url{http://yulab-smu.top/treedata-book/index.html} by Guangchuang Yu.
31
+}
27 32
 \seealso{
28 33
 \link[tidyr:nest]{unnest}
29 34
 }
... ...
@@ -7,9 +7,9 @@
7 7
 theme_dendrogram(bgcolor = "white", fgcolor = "black", ...)
8 8
 }
9 9
 \arguments{
10
-\item{bgcolor}{background color}
10
+\item{bgcolor}{set background color, defaults to "white"}
11 11
 
12
-\item{fgcolor}{color for axis}
12
+\item{fgcolor}{set color of axis}
13 13