git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@122021 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: ggtree |
2 | 2 |
Type: Package |
3 | 3 |
Title: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
4 |
-Version: 1.5.14 |
|
4 |
+Version: 1.5.15 |
|
5 | 5 |
Author: Guangchuang Yu and Tommy Tsan-Yuk Lam |
6 | 6 |
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com> |
7 | 7 |
Description: 'ggtree' extends the 'ggplot2' plotting system which implemented the grammar of graphics. |
... | ... |
@@ -165,7 +165,6 @@ importFrom(ape,read.tree) |
165 | 165 |
importFrom(ape,reorder.phylo) |
166 | 166 |
importFrom(ape,which.edge) |
167 | 167 |
importFrom(ape,write.tree) |
168 |
-importFrom(ggplot2,"%+replace%") |
|
169 | 168 |
importFrom(ggplot2,GeomCurve) |
170 | 169 |
importFrom(ggplot2,GeomLabel) |
171 | 170 |
importFrom(ggplot2,GeomPoint) |
... | ... |
@@ -214,6 +213,7 @@ importFrom(ggplot2,theme_bw) |
214 | 213 |
importFrom(ggplot2,xlab) |
215 | 214 |
importFrom(ggplot2,xlim) |
216 | 215 |
importFrom(ggplot2,ylab) |
216 |
+importFrom(ggplot2,ylim) |
|
217 | 217 |
importFrom(grDevices,col2rgb) |
218 | 218 |
importFrom(grDevices,colorRampPalette) |
219 | 219 |
importFrom(grDevices,rgb) |
... | ... |
@@ -1,3 +1,9 @@ |
1 |
+CHANGES IN VERSION 1.5.15 |
|
2 |
+------------------------ |
|
3 |
+ o check.aes for layers defined in ggtree <2016-10-07, Fri> |
|
4 |
+ o recalculate 'angle' when collapse, expand and rotate clade <2016-10-06, Thu> |
|
5 |
+ + https://github.com/GuangchuangYu/ggtree/issues/78 |
|
6 |
+ |
|
1 | 7 |
CHANGES IN VERSION 1.5.14 |
2 | 8 |
------------------------ |
3 | 9 |
o subset tip in geom_tiplab2 <2016-10-05, Wed> |
... | ... |
@@ -75,6 +75,9 @@ collapse <- function(tree_view=NULL, node) { |
75 | 75 |
## re-calculate branch mid position |
76 | 76 |
df <- calculate_branch_mid(df) |
77 | 77 |
|
78 |
+ ii <- which(!is.na(df$x)) |
|
79 |
+ df$angle[ii] <- calculate_angle(df[ii,])$angle |
|
80 |
+ |
|
78 | 81 |
tree_view$data <- df |
79 | 82 |
clade <- paste0("clade_", node) |
80 | 83 |
attr(tree_view, clade) <- sp.df |
... | ... |
@@ -121,7 +124,7 @@ expand <- function(tree_view=NULL, node) { |
121 | 124 |
## re-calculate branch mid position |
122 | 125 |
df <- calculate_branch_mid(df) |
123 | 126 |
|
124 |
- tree_view$data <- df |
|
127 |
+ tree_view$data <- calculate_angle(df) |
|
125 | 128 |
attr(tree_view, clade) <- NULL |
126 | 129 |
tree_view |
127 | 130 |
} |
... | ... |
@@ -156,7 +159,8 @@ rotate <- function(tree_view=NULL, node) { |
156 | 159 |
if (pnode != node && !is.na(pnode)) { |
157 | 160 |
df[df$node == pnode, "y"] <- mean(df[df$parent == pnode, "y"]) |
158 | 161 |
} |
159 |
- tree_view$data <- df |
|
162 |
+ |
|
163 |
+ tree_view$data <- calculate_angle(df) |
|
160 | 164 |
tree_view |
161 | 165 |
} |
162 | 166 |
|
... | ... |
@@ -218,6 +222,7 @@ flip <- function(tree_view=NULL, node1, node2) { |
218 | 222 |
currentNode <- currentNode[!currentNode %in% anc] |
219 | 223 |
|
220 | 224 |
tree_view$data <- re_assign_ycoord_df(df, currentNode) |
225 |
+ tree_view$data <- calculate_angle(tree_view$data) |
|
221 | 226 |
tree_view |
222 | 227 |
} |
223 | 228 |
|
... | ... |
@@ -281,7 +286,7 @@ scaleClade <- function(tree_view=NULL, node, scale=1, vertical_only=TRUE) { |
281 | 286 |
## re-calculate branch mid position |
282 | 287 |
df <- calculate_branch_mid(df) |
283 | 288 |
|
284 |
- tree_view$data <- df |
|
289 |
+ tree_view$data <- calculate_angle(df) |
|
285 | 290 |
tree_view |
286 | 291 |
} |
287 | 292 |
|
... | ... |
@@ -44,7 +44,8 @@ geom_balance <- function(node, fill="steelblue", color='white', alpha=.5, extend |
44 | 44 |
extend=extend, |
45 | 45 |
extendto=extendto, |
46 | 46 |
direction=1, |
47 |
- na.rm = na.rm) |
|
47 |
+ na.rm = na.rm), |
|
48 |
+ check.aes = FALSE |
|
48 | 49 |
) |
49 | 50 |
l2 <- layer( |
50 | 51 |
stat=StatBalance, |
... | ... |
@@ -61,7 +62,8 @@ geom_balance <- function(node, fill="steelblue", color='white', alpha=.5, extend |
61 | 62 |
extend=extend, |
62 | 63 |
extendto=extendto, |
63 | 64 |
direction=2, |
64 |
- na.rm = na.rm) |
|
65 |
+ na.rm = na.rm), |
|
66 |
+ check.aes = FALSE |
|
65 | 67 |
) |
66 | 68 |
return(c(l1,l2)) |
67 | 69 |
} |
... | ... |
@@ -113,7 +115,8 @@ stat_balance <- function(mapping=NULL, data=NULL, geom="rect", |
113 | 115 |
extend=extend, |
114 | 116 |
extendto=extendto, |
115 | 117 |
direction=1, |
116 |
- ...) |
|
118 |
+ ...), |
|
119 |
+ check.aes = FALSE |
|
117 | 120 |
) |
118 | 121 |
l2 <- layer( |
119 | 122 |
stat=StatBalance, |
... | ... |
@@ -130,7 +133,8 @@ stat_balance <- function(mapping=NULL, data=NULL, geom="rect", |
130 | 133 |
extend=extend, |
131 | 134 |
extendto=extendto, |
132 | 135 |
direction=2, |
133 |
- ...) |
|
136 |
+ ...), |
|
137 |
+ check.aes = FALSE |
|
134 | 138 |
) |
135 | 139 |
return(c(l1,l2)) |
136 | 140 |
} |
... | ... |
@@ -205,4 +209,4 @@ get_balance_position_ <- function(data, node, direction) { |
205 | 209 |
xmax = max(x), |
206 | 210 |
ymin=min(y)-0.5, |
207 | 211 |
ymax=max(y)+0.5) |
208 |
-} |
|
209 | 212 |
\ No newline at end of file |
213 |
+} |
... | ... |
@@ -128,7 +128,8 @@ stat_cladeText <- function(mapping=NULL, data=NULL, |
128 | 128 |
align = align, |
129 | 129 |
na.rm = na.rm, |
130 | 130 |
parse = parse, |
131 |
- ...) |
|
131 |
+ ...), |
|
132 |
+ check.aes = FALSE |
|
132 | 133 |
) |
133 | 134 |
|
134 | 135 |
} |
... | ... |
@@ -155,9 +156,9 @@ stat_cladeBar <- function(mapping=NULL, data=NULL, |
155 | 156 |
offset=offset, |
156 | 157 |
align=align, |
157 | 158 |
na.rm=na.rm, |
158 |
- ...) |
|
159 |
+ ...), |
|
160 |
+ check.aes = FALSE |
|
159 | 161 |
) |
160 |
- |
|
161 | 162 |
} |
162 | 163 |
|
163 | 164 |
StatCladeText <- ggproto("StatCladeText", Stat, |
... | ... |
@@ -97,7 +97,8 @@ stat_stripText <- function(mapping=NULL, data=NULL, |
97 | 97 |
barextend=barextend, |
98 | 98 |
na.rm=na.rm, |
99 | 99 |
parse=parse, |
100 |
- ...) |
|
100 |
+ ...), |
|
101 |
+ check.aes = FALSE |
|
101 | 102 |
) |
102 | 103 |
|
103 | 104 |
} |
... | ... |
@@ -132,7 +133,8 @@ stat_stripBar <- function(mapping=NULL, data=NULL, |
132 | 133 |
align=align, |
133 | 134 |
barextend=barextend, |
134 | 135 |
na.rm=na.rm, |
135 |
- ...) |
|
136 |
+ ...), |
|
137 |
+ check.aes = FALSE |
|
136 | 138 |
) |
137 | 139 |
|
138 | 140 |
} |
... | ... |
@@ -22,7 +22,8 @@ |
22 | 22 |
##' \link[ggplot2]{geom_text} |
23 | 23 |
##' @author Guangchuang Yu |
24 | 24 |
geom_text2 <- function(mapping = NULL, data = NULL, |
25 |
- position = "identity", parse = FALSE, na.rm=TRUE, show.legend = NA, inherit.aes = TRUE, |
|
25 |
+ position = "identity", parse = FALSE, na.rm=TRUE, show.legend = NA, |
|
26 |
+ inherit.aes = TRUE, |
|
26 | 27 |
..., nudge_x = 0, nudge_y = 0, check_overlap = FALSE) { |
27 | 28 |
|
28 | 29 |
if (!missing(nudge_x) || !missing(nudge_y)) { |
... | ... |
@@ -53,7 +54,8 @@ geom_text2 <- function(mapping = NULL, data = NULL, |
53 | 54 |
check_overlap = check_overlap, |
54 | 55 |
na.rm = na.rm, |
55 | 56 |
... |
56 |
- ) |
|
57 |
+ ), |
|
58 |
+ check.aes = FALSE |
|
57 | 59 |
) |
58 | 60 |
} |
59 | 61 |
|
... | ... |
@@ -91,7 +91,8 @@ geom_tiplab2 <- function(mapping=NULL, hjust=0, ...) { |
91 | 91 |
geom_tipsegment <- function(mapping=NULL, data=NULL, |
92 | 92 |
geom=GeomSegmentGGtree, position = "identity", |
93 | 93 |
offset, ..., |
94 |
- show.legend=NA, inherit.aes=FALSE, na.rm=TRUE) { |
|
94 |
+ show.legend=NA, inherit.aes=FALSE, |
|
95 |
+ na.rm=TRUE) { |
|
95 | 96 |
|
96 | 97 |
default_aes <- aes_(x=~x, y=~y) |
97 | 98 |
if (is.null(mapping)) { |
... | ... |
@@ -109,7 +110,8 @@ geom_tipsegment <- function(mapping=NULL, data=NULL, |
109 | 110 |
inherit.aes = inherit.aes, |
110 | 111 |
params = list(offset = offset, |
111 | 112 |
na.rm = na.rm, |
112 |
- ...) |
|
113 |
+ ...), |
|
114 |
+ check.aes = FALSE |
|
113 | 115 |
) |
114 | 116 |
} |
115 | 117 |
|
... | ... |
@@ -46,7 +46,8 @@ stat_tree <- function(mapping=NULL, data=NULL, geom="segment", position="identit |
46 | 46 |
params=list(layout = layout, |
47 | 47 |
lineend = lineend, |
48 | 48 |
na.rm = na.rm, |
49 |
- ...) |
|
49 |
+ ...), |
|
50 |
+ check.aes = FALSE |
|
50 | 51 |
), |
51 | 52 |
layer(data=data, |
52 | 53 |
mapping=mapping, |
... | ... |
@@ -58,7 +59,8 @@ stat_tree <- function(mapping=NULL, data=NULL, geom="segment", position="identit |
58 | 59 |
params=list(layout = layout, |
59 | 60 |
lineend = lineend, |
60 | 61 |
na.rm = na.rm, |
61 |
- ...) |
|
62 |
+ ...), |
|
63 |
+ check.aes = FALSE |
|
62 | 64 |
) |
63 | 65 |
) |
64 | 66 |
} else if (layout %in% c("slanted", "radial", "unrooted")) { |
... | ... |
@@ -72,7 +74,8 @@ stat_tree <- function(mapping=NULL, data=NULL, geom="segment", position="identit |
72 | 74 |
params=list(layout = layout, |
73 | 75 |
lineend = lineend, |
74 | 76 |
na.rm = na.rm, |
75 |
- ...) |
|
77 |
+ ...), |
|
78 |
+ check.aes = FALSE |
|
76 | 79 |
) |
77 | 80 |
} |
78 | 81 |
} |
... | ... |
@@ -21,7 +21,7 @@ |
21 | 21 |
##' @importFrom ggplot2 ylab |
22 | 22 |
##' @importFrom ggplot2 annotate |
23 | 23 |
##' @importFrom ggplot2 scale_x_reverse |
24 |
-##' @importFrom ggplot2 scale_y_continuous |
|
24 |
+##' @importFrom ggplot2 ylim |
|
25 | 25 |
##' @importFrom ggplot2 coord_flip |
26 | 26 |
##' @importFrom ggplot2 coord_polar |
27 | 27 |
##' @export |
... | ... |
@@ -86,7 +86,7 @@ ggtree <- function(tr, |
86 | 86 |
p <- layout_circular(p) |
87 | 87 |
## refer to: https://github.com/GuangchuangYu/ggtree/issues/6 |
88 | 88 |
## and also have some space for tree scale (legend) |
89 |
- p <- p + scale_y_continuous(limits=c(0, max(p$data$y)+1)) |
|
89 |
+ p <- p + ylim(0, NA) |
|
90 | 90 |
} else if (layout == "fan") { |
91 | 91 |
p <- layout_fan(p, open.angle) |
92 | 92 |
} |
... | ... |
@@ -74,9 +74,9 @@ gheatmap <- function(p, data, offset=0, width=1, low="green", high="red", color= |
74 | 74 |
dd$width <- width |
75 | 75 |
|
76 | 76 |
if (is.null(color)) { |
77 |
- p2 <- p + geom_tile(data=dd, aes(x, y, fill=value, width=width), inherit.aes=FALSE) |
|
77 |
+ p2 <- p + geom_tile(data=dd, aes(x, y, fill=value), width=width, inherit.aes=FALSE) |
|
78 | 78 |
} else { |
79 |
- p2 <- p + geom_tile(data=dd, aes(x, y, fill=value, width=width), color=color, inherit.aes=FALSE) |
|
79 |
+ p2 <- p + geom_tile(data=dd, aes(x, y, fill=value), width=width, color=color, inherit.aes=FALSE) |
|
80 | 80 |
} |
81 | 81 |
if (is(dd$value,"numeric")) { |
82 | 82 |
p2 <- p2 + scale_fill_gradient(low=low, high=high, na.value="white") |
... | ... |
@@ -12,7 +12,7 @@ |
12 | 12 |
##' @return tree view with insets |
13 | 13 |
##' @export |
14 | 14 |
##' @author Guangchuang Yu |
15 |
-inset <- function(tree_view, insets, width=0.05, height=0.05, hjust=0, vjust=0, x="node") { |
|
15 |
+inset <- function(tree_view, insets, width=0.1, height=0.1, hjust=0, vjust=0, x="node") { |
|
16 | 16 |
df <- tree_view$data[as.numeric(names(insets)),] |
17 | 17 |
x <- match.arg(x, c("node", "branch", "edge")) |
18 | 18 |
|
... | ... |
@@ -25,6 +25,7 @@ layout_circular <- function(treeview) { |
25 | 25 |
##' @param treeview tree view |
26 | 26 |
##' @param angle angle |
27 | 27 |
##' @return updated tree view |
28 |
+##' @importFrom ggplot2 scale_y_continuous |
|
28 | 29 |
##' @export |
29 | 30 |
##' @author Guangchuang Yu |
30 | 31 |
open_tree <- function(treeview, angle) { |
... | ... |
@@ -36,7 +37,7 @@ open_tree <- function(treeview, angle) { |
36 | 37 |
N <- nrow(p$data) |
37 | 38 |
idx <- match(1:N, order(p$data$y)) |
38 | 39 |
NN <- N *(1+angle/(360-angle)) |
39 |
- angle <- 360/(3+NN) * (1:N+1) |
|
40 |
+ angle <- 360/(2+NN) * (1:N+1) |
|
40 | 41 |
angle <- angle[idx] |
41 | 42 |
p$data$angle <- angle |
42 | 43 |
return(p) |
... | ... |
@@ -558,15 +558,7 @@ as.data.frame.phylo_ <- function(x, layout="rectangular", |
558 | 558 |
res <- calculate_branch_mid(res) |
559 | 559 |
|
560 | 560 |
## ## angle for all layout, if 'rectangular', user use coord_polar, can still use angle |
561 |
- ## ## if (layout == "circular") { |
|
562 |
- ## idx <- match(1:N, order(res$y)) |
|
563 |
- ## ## angle <- -360/(3+N) * (1:N+1) |
|
564 |
- ## angle <- 360/(3+N) * (1:N+1) |
|
565 |
- ## angle <- angle[idx] |
|
566 |
- ## ## res$angle <- angle + 90 |
|
567 |
- ## res$angle <- angle |
|
568 |
- ## } |
|
569 |
- res$angle <- 360/(diff(range(res$y)) + 1) * res$y |
|
561 |
+ res <- calculate_angle(res) |
|
570 | 562 |
return(res) |
571 | 563 |
} |
572 | 564 |
|
... | ... |
@@ -692,3 +684,9 @@ fortify.phyloseq <- function(model, data, layout="rectangular", |
692 | 684 |
## ggplot(df) + geom_tree() |
693 | 685 |
|
694 | 686 |
## } |
687 |
+ |
|
688 |
+ |
|
689 |
+calculate_angle <- function(data) { |
|
690 |
+ data$angle <- 360/(diff(range(data$y)) + 1) * data$y |
|
691 |
+ return(data) |
|
692 |
+} |
... | ... |
@@ -8,7 +8,6 @@ |
8 | 8 |
##' @importFrom ggplot2 theme_bw |
9 | 9 |
##' @importFrom ggplot2 theme |
10 | 10 |
##' @importFrom ggplot2 element_blank |
11 |
-##' @importFrom ggplot2 %+replace% |
|
12 | 11 |
##' @importFrom ggplot2 xlab |
13 | 12 |
##' @importFrom ggplot2 ylab |
14 | 13 |
##' @export |
... | ... |
@@ -21,12 +20,12 @@ |
21 | 20 |
theme_tree <- function(bgcolor="white", fgcolor="black", ...) { |
22 | 21 |
list(xlab(NULL), |
23 | 22 |
ylab(NULL), |
24 |
- theme_tree2_internal() %+replace% |
|
25 |
- theme(panel.background=element_rect(fill=bgcolor, colour=bgcolor), |
|
26 |
- axis.line.x = element_blank(), |
|
27 |
- axis.text.x = element_blank(), |
|
28 |
- axis.ticks.x = element_blank(), |
|
29 |
- ...) |
|
23 |
+ theme_tree2_internal() + |
|
24 |
+ theme(panel.background=element_rect(fill=bgcolor, colour=bgcolor), |
|
25 |
+ axis.line.x = element_blank(), |
|
26 |
+ axis.text.x = element_blank(), |
|
27 |
+ axis.ticks.x = element_blank(), |
|
28 |
+ ...) |
|
30 | 29 |
) |
31 | 30 |
} |
32 | 31 |
|
... | ... |
@@ -41,7 +40,6 @@ theme_tree <- function(bgcolor="white", fgcolor="black", ...) { |
41 | 40 |
##' @importFrom ggplot2 theme |
42 | 41 |
##' @importFrom ggplot2 element_blank |
43 | 42 |
##' @importFrom ggplot2 element_line |
44 |
-##' @importFrom ggplot2 %+replace% |
|
45 | 43 |
##' @importFrom ggplot2 element_rect |
46 | 44 |
##' @export |
47 | 45 |
##' @return updated ggplot object with new theme |
... | ... |
@@ -65,18 +63,18 @@ theme_tree2_internal <- function(bgcolor="white", fgcolor="black", |
65 | 63 |
axis.line.y=element_blank(), |
66 | 64 |
axis.ticks.y=element_blank(), |
67 | 65 |
axis.text.y=element_blank(),...) { |
68 |
- theme_bw() %+replace% |
|
69 |
- theme(legend.position=legend.position, |
|
70 |
- panel.grid.minor=panel.grid.minor, |
|
71 |
- panel.grid.major=panel.grid.major, |
|
72 |
- panel.background=element_rect(fill=bgcolor, colour=bgcolor), |
|
73 |
- panel.border=panel.border, |
|
74 |
- ## axis.line=element_line(color=fgcolor), |
|
75 |
- axis.line.x=element_line(color=fgcolor), |
|
76 |
- axis.line.y=axis.line.y, |
|
77 |
- axis.ticks.y=axis.ticks.y, |
|
78 |
- axis.text.y=axis.text.y, |
|
79 |
- ...) |
|
66 |
+ theme_bw() + |
|
67 |
+ theme(legend.position=legend.position, |
|
68 |
+ panel.grid.minor=panel.grid.minor, |
|
69 |
+ panel.grid.major=panel.grid.major, |
|
70 |
+ panel.background=element_rect(fill=bgcolor, colour=bgcolor), |
|
71 |
+ panel.border=panel.border, |
|
72 |
+ ## axis.line=element_line(color=fgcolor), |
|
73 |
+ axis.line.x=element_line(color=fgcolor), |
|
74 |
+ axis.line.y=axis.line.y, |
|
75 |
+ axis.ticks.y=axis.ticks.y, |
|
76 |
+ axis.text.y=axis.text.y, |
|
77 |
+ ...) |
|
80 | 78 |
} |
81 | 79 |
|
82 | 80 |
##' transparent background theme |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
2 | 2 |
=========================================================================================================================== |
3 | 3 |
|
4 |
-[](https://bioconductor.org/packages/ggtree) [](https://github.com/GuangchuangYu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
4 |
+[](https://bioconductor.org/packages/ggtree) [](https://github.com/GuangchuangYu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
5 | 5 |
|
6 |
-[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
6 |
+[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
7 | 7 |
|
8 | 8 |
[](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [](https://travis-ci.org/GuangchuangYu/ggtree) [](https://ci.appveyor.com/project/GuangchuangYu/ggtree) [](http://bioconda.github.io/recipes/bioconductor-ggtree/README.html) |
9 | 9 |
|
... | ... |
@@ -112,7 +112,7 @@ inset(p, bars) |
112 | 112 |
The sizes of the insets can be ajusted by the paramter *width* and *height*. |
113 | 113 |
|
114 | 114 |
```{r} |
115 |
-inset(p, bars, width=.03, height=.06) |
|
115 |
+inset(p, bars, width=.06, height=.1) |
|
116 | 116 |
``` |
117 | 117 |
|
118 | 118 |
Users can set the color via the parameter *color*. The *x* position can be one of 'node' or 'branch' and can be adjusted by the parameter *hjust* and *vjust* for horizontal and vertical adjustment respecitvely. |
... | ... |
@@ -121,7 +121,7 @@ Users can set the color via the parameter *color*. The *x* position can be one o |
121 | 121 |
```{r} |
122 | 122 |
bars2 <- nodebar(dat, cols=1:4, position='dodge', |
123 | 123 |
color=c(a='blue', b='red', c='green', d='cyan')) |
124 |
-p2 <- inset(p, bars2, x='branch', width=.03, vjust=-.3) |
|
124 |
+p2 <- inset(p, bars2, x='branch', width=.06, vjust=-.3) |
|
125 | 125 |
print(p2) |
126 | 126 |
``` |
127 | 127 |
|
... | ... |
@@ -157,7 +157,7 @@ bx <- lapply(d, function(y) { |
157 | 157 |
ggplot(dd, aes(x=1, y=y))+geom_boxplot() + ylim(ylim) + theme_inset() |
158 | 158 |
}) |
159 | 159 |
names(bx) <- 1:15 |
160 |
-inset(p, bx, width=.03, height=.1, hjust=-.05) |
|
160 |
+inset(p, bx, width=.06, height=.2, hjust=-.05) |
|
161 | 161 |
``` |
162 | 162 |
|
163 | 163 |
|
... | ... |
@@ -167,7 +167,7 @@ After annotating with insets, users can further annotate the tree with another l |
167 | 167 |
p2 <- inset(p, bars2, x='branch', width=.03, vjust=-.4) |
168 | 168 |
p2 <- inset(p2, pies, x='branch', vjust=.4) |
169 | 169 |
bx2 <- lapply(bx, function(g) g+coord_flip()) |
170 |
-inset(p2, bx2, width=.2, height=.03, vjust=.04, hjust=p2$data$x[1:15]-4) + xlim(NA, 4.5) |
|
170 |
+inset(p2, bx2, width=.4, height=.06, vjust=.04, hjust=p2$data$x[1:15]-4) + xlim(NA, 4.5) |
|
171 | 171 |
``` |
172 | 172 |
|
173 | 173 |
## Annotate with image files |
... | ... |
@@ -141,7 +141,7 @@ ggtree(chiroptera, aes(color=group), layout='circular') + geom_tiplab(size=1, ae |
141 | 141 |
|
142 | 142 |
In this example, we first build a tree based on the iris data, then grouping the tree based on different spacies. |
143 | 143 |
|
144 |
-```{r fig.width=20, fig.height=20, fig.align="center", warning=FALSE} |
|
144 |
+#```{r fig.width=20, fig.height=20, fig.align="center", warning=FALSE} |
|
145 | 145 |
data(iris) |
146 | 146 |
rn <- paste0(iris[,5], "_", 1:150) |
147 | 147 |
rownames(iris) <- rn |
... | ... |
@@ -157,7 +157,7 @@ ggtree(tree_iris, aes(color=group)) + |
157 | 157 |
scale_color_manual(values=cols, breaks=1:3, |
158 | 158 |
labels=c("Setosa", "Versicolor", "Virginica")) + |
159 | 159 |
theme(legend.position="right") |
160 |
-``` |
|
160 |
+#``` |
|
161 | 161 |
--> |
162 | 162 |
|
163 | 163 |
|