... | ... |
@@ -2,9 +2,9 @@ |
2 | 2 |
ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
3 | 3 |
=========================================================================================================================== |
4 | 4 |
|
5 |
-[](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) <img src="logo.png" align="right" /> |
|
5 |
+[](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) <img src="logo.png" align="right" /> |
|
6 | 6 |
|
7 |
-[](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 |
+[](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) |
|
8 | 8 |
|
9 | 9 |
[](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) |
10 | 10 |
|
... | ... |
@@ -187,6 +187,8 @@ |
187 | 187 |
|
188 | 188 |
<li><a href="#tip-label-truncated"> Tip label truncated</a></li> |
189 | 189 |
|
190 |
+ <li><a href="#modify-tip-labels"> Modify (tip) labels</a></li> |
|
191 |
+ |
|
190 | 192 |
<li><a href="#formatting-tip-labels"> Formatting (tip) labels</a></li> |
191 | 193 |
|
192 | 194 |
<li><a href="#avoid-overlapping-text-labels"> Avoid overlapping text labels</a></li> |
... | ... |
@@ -198,6 +200,8 @@ |
198 | 200 |
|
199 | 201 |
<li><a href="#inherit-aes"> inherit aes</a></li> |
200 | 202 |
|
203 |
+ <li><a href="#use-in-aes"> use $ in aes</a></li> |
|
204 |
+ |
|
201 | 205 |
|
202 | 206 |
<li class="main "><a href="#annotation"> Annotation</a></li> |
203 | 207 |
|
... | ... |
@@ -247,6 +251,21 @@ ggtree(tree) + geom_tiplab() |
247 | 251 |
<pre><code class="r">ggtree(tree) + geom_tiplab() + xlim(0, 0.06) |
248 | 252 |
</code></pre> |
249 | 253 |
|
254 |
+<h2 id="modify-tip-labels"><i class="fa fa-angle-double-right"></i> Modify (tip) labels</h2> |
|
255 |
+<p>This could be easily done via the <code>%<+%</code> operator to attach the |
|
256 |
+modified version of the labels and than use <code>geom_tiplab</code> to display |
|
257 |
+the modified version.</p> |
|
258 |
+<pre><code>raxml_file <- system.file("extdata/RAxML", "RAxML_bipartitionsBranchLabels.H3", package="ggtree") |
|
259 |
+raxml <- read.raxml(raxml_file) |
|
260 |
+ |
|
261 |
+lb = get.tree(raxml)$tip.label |
|
262 |
+d = data.frame(label=lb, label2 = paste("AA", substring(lb, 1, 5))) |
|
263 |
+ggtree(raxml) %<+% d + geom_tiplab(aes(label=label2)) |
|
264 |
+</code></pre> |
|
265 |
+ |
|
266 |
+<p>see also |
|
267 |
+<a href="https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/tFdFgCJ7gQA/tZ6phSgUDQAJ">1</a> |
|
268 |
+and <a href="https://github.com/GuangchuangYu/ggtree/issues/106">2</a>.</p> |
|
250 | 269 |
<h2 id="formatting-tip-labels"><i class="fa fa-angle-double-right"></i> Formatting (tip) labels</h2> |
251 | 270 |
<p>If you want to format labels, you need to set <code>parse=TRUE</code> in <code>geom_text</code>/<code>geom_tiplab</code> and the <code>label</code> should be string that can be parsed into expression and displayed as described in <code>?plotmath</code>.</p> |
252 | 271 |
<p>For example, the tiplabels contains two parts, species name and accession number and we want to display species name in <em>italic</em>, we can use command like this:</p> |
... | ... |
@@ -296,6 +315,15 @@ As these variable is not available in your <code>dataset</code>, you will get th |
296 | 315 |
</code></pre> |
297 | 316 |
|
298 | 317 |
<p>This can be fixed by using parameter <code>inherit.aes=FALSE</code> which will disable inheriting mapping from <code>ggtree</code> function.</p> |
318 |
+<h2 id="use-in-aes"><i class="fa fa-angle-double-right"></i> use <code>$</code> in aes</h2> |
|
319 |
+<p>NEVER DO THIS.</p> |
|
320 |
+<p>see the explaination in the <a href="https://github.com/hadley/ggplot2-book/blob/master/layers.rmd#aesthetic-mappings-secaes">ggplot2 book 2ed</a>:</p> |
|
321 |
+<blockquote> |
|
322 |
+<p>Never refer to a variable with <code>$</code> (e.g., <code>diamonds$carat</code>) in <code>aes()</code>. This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \indexc{\$}</p> |
|
323 |
+</blockquote> |
|
324 |
+<p>see also |
|
325 |
+<a href="https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/hViM6vRZF94/MsZT8qRgBwAJ">1</a> |
|
326 |
+and <a href="https://github.com/GuangchuangYu/ggtree/issues/106">2</a>.</p> |
|
299 | 327 |
<h1 id="annotation"><i class="fa fa-tree"></i> Annotation</h1> |
300 | 328 |
<h2 id="colouring-edges-by-user-data"><i class="fa fa-angle-double-right"></i> colouring edges by user data</h2> |
301 | 329 |
<p>see my answer on <a href="https://github.com/GuangchuangYu/ggtree/issues/76">https://github.com/GuangchuangYu/ggtree/issues/76</a> |
... | ... |
@@ -223,11 +223,11 @@ |
223 | 223 |
} |
224 | 224 |
</style> |
225 | 225 |
|
226 |
-<div id = 'chartf187d00a00e' class = 'rChart morris'></div> |
|
226 |
+<div id = 'chart4057456ed9b' class = 'rChart morris'></div> |
|
227 | 227 |
|
228 | 228 |
<script type='text/javascript'> |
229 | 229 |
var chartParams = { |
230 |
- "element": "chartf187d00a00e", |
|
230 |
+ "element": "chart4057456ed9b", |
|
231 | 231 |
"width": 800, |
232 | 232 |
"height": 400, |
233 | 233 |
"xkey": "year", |
... | ... |
@@ -241,7 +241,7 @@ |
241 | 241 |
"pubid": "HtEfBTGE9r8C" |
242 | 242 |
} |
243 | 243 |
], |
244 |
-"id": "chartf187d00a00e", |
|
244 |
+"id": "chart4057456ed9b", |
|
245 | 245 |
"labels": "cites" |
246 | 246 |
}, |
247 | 247 |
chartType = "Bar" |
... | ... |
@@ -235,7 +235,7 @@ |
235 | 235 |
|
236 | 236 |
<p><img src="https://raw.githubusercontent.com/GuangchuangYu/ggtree/master/logo.png" align="right" /></p> |
237 | 237 |
<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p> |
238 |
-<p><a href="https://bioconductor.org/packages/ggtree"><img alt="releaseVersion" src="https://img.shields.io/badge/release%20version-1.6.4-blue.svg?style=flat" /></a> |
|
238 |
+<p><a href="https://bioconductor.org/packages/ggtree"><img alt="releaseVersion" src="https://img.shields.io/badge/release%20version-1.6.5-blue.svg?style=flat" /></a> |
|
239 | 239 |
<a href="https://github.com/GuangchuangYu/ggtree"><img alt="develVersion" src="https://img.shields.io/badge/devel%20version-1.7.4-blue.svg?style=flat" /></a> |
240 | 240 |
<a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img alt="total" src="https://img.shields.io/badge/downloads-18149/total-blue.svg?style=flat" /></a> |
241 | 241 |
<a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img alt="month" src="https://img.shields.io/badge/downloads-1852/month-blue.svg?style=flat" /></a></p> |
... | ... |
@@ -137,7 +137,7 @@ |
137 | 137 |
}, |
138 | 138 |
{ |
139 | 139 |
"location": "/faq/", |
140 |
- "text": "Installation\n\n\n Could not find function\n\n\nIf you got \nthis error\n, please make sure you are using the latest R and \nggtree\n.\n\n\nPackages in Bioconductor, like \nggtree\n, have different release policy compare to CRAN. There are two branches, release and devel, in parallel. Release branch is more stable and only document improvement and bug fixes will commit to it. New functions will only commit to \ndevel\n branch.\n\n\nSometimes I may write blog post to introduce new functions which is not available in \nrelease\n branch, you need to install the \ndevel\n version of \nggtree\n in order to use these new functions.\n\n\nYou can download the \ndevel\n version of \nggtree\n from \nhttp://bioconductor.org/packages/devel/bioc/html/ggtree.html\n and install it, or install the github version of \nggtree\n.\n\n\nThis also applied to other of my packages, including \nGOSemSim\n, \nDOSE\n, \nclusterProfiler\n, \nReactomePA\n and \nChIPseeker\n. If you got the \ncould not find function\n error, upgrade your installation to latest release. If the error still exists after upgrading to latest release, you need to install the devel version.\n\n\n Text \n Label\n\n\n Tip label truncated\n\n\nggplot2 can't auto adjust xlim based on added text.\n\n\nlibrary(ggtree)\n## example tree from https://support.bioconductor.org/p/72398/\ntree\n-read.tree(text=\n(Organism1.006G249400.1:0.03977,(Organism2.022118m:0.01337,(Organism3.J34265.1:0.00284,Organism4.G02633.1:0.00468)0.51:0.0104):0.02469);\n)\nggtree(tree) + geom_tiplab()\n\n\n\n\nThis is because the units are in two different spaces (data and pixel). Users can use xlim to allocate more space for tip label.\n\n\nggtree(tree) + geom_tiplab() + xlim(0, 0.06)\n\n\n\n\n Formatting (tip) labels\n\n\nIf you want to format labels, you need to set \nparse=TRUE\n in \ngeom_text\n/\ngeom_tiplab\n and the \nlabel\n should be string that can be parsed into expression and displayed as described in \n?plotmath\n.\n\n\nFor example, the tiplabels contains two parts, species name and accession number and we want to display species name in \nitalic\n, we can use command like this:\n\n\nggtree(rtree(30)) + geom_tiplab(aes(subset=node==35), label='paste(italic(\nspecies name\n), \naccession number\n)', parse=T)\n\n\n\n\n Avoid overlapping text labels\n\n\nUser can use \nggrepel\n package to repel overlapping text labels.\n\n\nFor example:\n\n\nlibrary(ggrepel)\nlibrary(ggtree)\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\nggtree(raxml) + geom_label_repel(aes(label=bootstrap, fill=bootstrap))\n\n\n\n\nFor details, please refer to \nggrepel usage examples\n.\n\n\n bootstrap values from newick format\n\n\nIt's quite command to store \nbootstrap\n value as node label in \nnewick\n format. Visualizing node label is easy using \ngeom_text2(aes(subset = !isTip, label=label))\n.\n\n\nIf you want to only display a subset of \nbootstrap\n (e.g. bootstrap \n 80), you can't simply using \ngeom_text2(subset= (label \n 80), label=label)\n since \nlabel\n is a character vector, which contains node label (bootstrap value) and tip label (taxa name). If we use \ngeom_text2(subset=(as.numeric(label) \n 80), label=label)\n, it will also fail since \nNAs\n were introduced by coercion. We need to convert \nNAs\n to logical \nFALSE\n, this can be done by the following code:\n\n\nnwk \n- system.file(\nextdata/RAxML\n,\nRAxML_bipartitions.H3\n, package='ggtree')\ntr \n- read.tree(nwk)\nggtree(tr) + geom_text2(aes(label=label, subset = !is.na(as.numeric(label)) \n as.numeric(label) \n 80))\n\n\n\n\nAnother solution is converting the bootstrap value outside \nggtree\n as I recommended in \ngoogle group\n.\n\n\nq \n- ggtree(tr)\nd \n- q$data\nd \n- d[!d$isTip,]\nd$label \n- as.numeric(d$label)\nd \n- d[d$label \n 80,]\n\nq + geom_text(data=d, aes(label=label))\n\n\n\n\n \naesthetic\n mapping\n\n\n inherit \naes\n\n\nggtree(rtree(30)) + geom_point()\n\n\n\n\nFor example, we can add symbolic points to nodes with \ngeom_point()\n directly.\nThe magic here is we don't need to map \nx\n and \ny\n position of the points by providing \naes(x, y)\n to \ngeom_point()\n since it was already mapped by \nggtree\n function and it serves as a global mapping for all layers.\n\n\nBut what if we provide a \ndataset\n in a layer and the \ndataset\n doesn't contain column of \nx\n and/or \ny\n,\nthe layer function also try to map \nx\n and \ny\n and also others if you map them in \nggtree\n function.\nAs these variable is not available in your \ndataset\n, you will get the following error:\n\n\nError in eval(expr, envir, enclos) : object 'x' not found\n\n\n\n\nThis can be fixed by using parameter \ninherit.aes=FALSE\n which will disable inheriting mapping from \nggtree\n function.\n\n\n Annotation\n\n\n colouring edges by user data\n\n\nsee my answer on \nhttps://github.com/GuangchuangYu/ggtree/issues/76\n\nand \nhttps://groups.google.com/forum/#!topic/bioc-ggtree/4GgivKqVjB8\n.", |
|
140 |
+ "text": "Installation\n\n\n Could not find function\n\n\nIf you got \nthis error\n, please make sure you are using the latest R and \nggtree\n.\n\n\nPackages in Bioconductor, like \nggtree\n, have different release policy compare to CRAN. There are two branches, release and devel, in parallel. Release branch is more stable and only document improvement and bug fixes will commit to it. New functions will only commit to \ndevel\n branch.\n\n\nSometimes I may write blog post to introduce new functions which is not available in \nrelease\n branch, you need to install the \ndevel\n version of \nggtree\n in order to use these new functions.\n\n\nYou can download the \ndevel\n version of \nggtree\n from \nhttp://bioconductor.org/packages/devel/bioc/html/ggtree.html\n and install it, or install the github version of \nggtree\n.\n\n\nThis also applied to other of my packages, including \nGOSemSim\n, \nDOSE\n, \nclusterProfiler\n, \nReactomePA\n and \nChIPseeker\n. If you got the \ncould not find function\n error, upgrade your installation to latest release. If the error still exists after upgrading to latest release, you need to install the devel version.\n\n\n Text \n Label\n\n\n Tip label truncated\n\n\nggplot2 can't auto adjust xlim based on added text.\n\n\nlibrary(ggtree)\n## example tree from https://support.bioconductor.org/p/72398/\ntree\n-read.tree(text=\n(Organism1.006G249400.1:0.03977,(Organism2.022118m:0.01337,(Organism3.J34265.1:0.00284,Organism4.G02633.1:0.00468)0.51:0.0104):0.02469);\n)\nggtree(tree) + geom_tiplab()\n\n\n\n\nThis is because the units are in two different spaces (data and pixel). Users can use xlim to allocate more space for tip label.\n\n\nggtree(tree) + geom_tiplab() + xlim(0, 0.06)\n\n\n\n\n Modify (tip) labels\n\n\nThis could be easily done via the \n%\n+%\n operator to attach the\nmodified version of the labels and than use \ngeom_tiplab\n to display\nthe modified version.\n\n\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\n\nlb = get.tree(raxml)$tip.label\nd = data.frame(label=lb, label2 = paste(\nAA\n, substring(lb, 1, 5)))\nggtree(raxml) %\n+% d + geom_tiplab(aes(label=label2))\n\n\n\n\nsee also\n\n1\n\nand \n2\n.\n\n\n Formatting (tip) labels\n\n\nIf you want to format labels, you need to set \nparse=TRUE\n in \ngeom_text\n/\ngeom_tiplab\n and the \nlabel\n should be string that can be parsed into expression and displayed as described in \n?plotmath\n.\n\n\nFor example, the tiplabels contains two parts, species name and accession number and we want to display species name in \nitalic\n, we can use command like this:\n\n\nggtree(rtree(30)) + geom_tiplab(aes(subset=node==35), label='paste(italic(\nspecies name\n), \naccession number\n)', parse=T)\n\n\n\n\n Avoid overlapping text labels\n\n\nUser can use \nggrepel\n package to repel overlapping text labels.\n\n\nFor example:\n\n\nlibrary(ggrepel)\nlibrary(ggtree)\nraxml_file \n- system.file(\nextdata/RAxML\n, \nRAxML_bipartitionsBranchLabels.H3\n, package=\nggtree\n)\nraxml \n- read.raxml(raxml_file)\nggtree(raxml) + geom_label_repel(aes(label=bootstrap, fill=bootstrap))\n\n\n\n\nFor details, please refer to \nggrepel usage examples\n.\n\n\n bootstrap values from newick format\n\n\nIt's quite command to store \nbootstrap\n value as node label in \nnewick\n format. Visualizing node label is easy using \ngeom_text2(aes(subset = !isTip, label=label))\n.\n\n\nIf you want to only display a subset of \nbootstrap\n (e.g. bootstrap \n 80), you can't simply using \ngeom_text2(subset= (label \n 80), label=label)\n since \nlabel\n is a character vector, which contains node label (bootstrap value) and tip label (taxa name). If we use \ngeom_text2(subset=(as.numeric(label) \n 80), label=label)\n, it will also fail since \nNAs\n were introduced by coercion. We need to convert \nNAs\n to logical \nFALSE\n, this can be done by the following code:\n\n\nnwk \n- system.file(\nextdata/RAxML\n,\nRAxML_bipartitions.H3\n, package='ggtree')\ntr \n- read.tree(nwk)\nggtree(tr) + geom_text2(aes(label=label, subset = !is.na(as.numeric(label)) \n as.numeric(label) \n 80))\n\n\n\n\nAnother solution is converting the bootstrap value outside \nggtree\n as I recommended in \ngoogle group\n.\n\n\nq \n- ggtree(tr)\nd \n- q$data\nd \n- d[!d$isTip,]\nd$label \n- as.numeric(d$label)\nd \n- d[d$label \n 80,]\n\nq + geom_text(data=d, aes(label=label))\n\n\n\n\n \naesthetic\n mapping\n\n\n inherit \naes\n\n\nggtree(rtree(30)) + geom_point()\n\n\n\n\nFor example, we can add symbolic points to nodes with \ngeom_point()\n directly.\nThe magic here is we don't need to map \nx\n and \ny\n position of the points by providing \naes(x, y)\n to \ngeom_point()\n since it was already mapped by \nggtree\n function and it serves as a global mapping for all layers.\n\n\nBut what if we provide a \ndataset\n in a layer and the \ndataset\n doesn't contain column of \nx\n and/or \ny\n,\nthe layer function also try to map \nx\n and \ny\n and also others if you map them in \nggtree\n function.\nAs these variable is not available in your \ndataset\n, you will get the following error:\n\n\nError in eval(expr, envir, enclos) : object 'x' not found\n\n\n\n\nThis can be fixed by using parameter \ninherit.aes=FALSE\n which will disable inheriting mapping from \nggtree\n function.\n\n\n use \n$\n in aes\n\n\nNEVER DO THIS.\n\n\nsee the explaination in the \nggplot2 book 2ed\n:\n\n\n\n\nNever refer to a variable with \n$\n (e.g., \ndiamonds$carat\n) in \naes()\n. This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \\indexc{\\$}\n\n\n\n\nsee also\n\n1\n\nand \n2\n.\n\n\n Annotation\n\n\n colouring edges by user data\n\n\nsee my answer on \nhttps://github.com/GuangchuangYu/ggtree/issues/76\n\nand \nhttps://groups.google.com/forum/#!topic/bioc-ggtree/4GgivKqVjB8\n.", |
|
141 | 141 |
"title": "FAQ" |
142 | 142 |
}, |
143 | 143 |
{ |
... | ... |
@@ -160,6 +160,11 @@ |
160 | 160 |
"text": "ggplot2 can't auto adjust xlim based on added text. library(ggtree)\n## example tree from https://support.bioconductor.org/p/72398/\ntree -read.tree(text= (Organism1.006G249400.1:0.03977,(Organism2.022118m:0.01337,(Organism3.J34265.1:0.00284,Organism4.G02633.1:0.00468)0.51:0.0104):0.02469); )\nggtree(tree) + geom_tiplab() This is because the units are in two different spaces (data and pixel). Users can use xlim to allocate more space for tip label. ggtree(tree) + geom_tiplab() + xlim(0, 0.06)", |
161 | 161 |
"title": " Tip label truncated" |
162 | 162 |
}, |
163 |
+ { |
|
164 |
+ "location": "/faq/#modify-tip-labels", |
|
165 |
+ "text": "This could be easily done via the % +% operator to attach the\nmodified version of the labels and than use geom_tiplab to display\nthe modified version. raxml_file - system.file( extdata/RAxML , RAxML_bipartitionsBranchLabels.H3 , package= ggtree )\nraxml - read.raxml(raxml_file)\n\nlb = get.tree(raxml)$tip.label\nd = data.frame(label=lb, label2 = paste( AA , substring(lb, 1, 5)))\nggtree(raxml) % +% d + geom_tiplab(aes(label=label2)) see also 1 \nand 2 .", |
|
166 |
+ "title": " Modify (tip) labels" |
|
167 |
+ }, |
|
163 | 168 |
{ |
164 | 169 |
"location": "/faq/#formatting-tip-labels", |
165 | 170 |
"text": "If you want to format labels, you need to set parse=TRUE in geom_text / geom_tiplab and the label should be string that can be parsed into expression and displayed as described in ?plotmath . For example, the tiplabels contains two parts, species name and accession number and we want to display species name in italic , we can use command like this: ggtree(rtree(30)) + geom_tiplab(aes(subset=node==35), label='paste(italic( species name ), accession number )', parse=T)", |
... | ... |
@@ -185,6 +190,11 @@ |
185 | 190 |
"text": "ggtree(rtree(30)) + geom_point() For example, we can add symbolic points to nodes with geom_point() directly.\nThe magic here is we don't need to map x and y position of the points by providing aes(x, y) to geom_point() since it was already mapped by ggtree function and it serves as a global mapping for all layers. But what if we provide a dataset in a layer and the dataset doesn't contain column of x and/or y ,\nthe layer function also try to map x and y and also others if you map them in ggtree function.\nAs these variable is not available in your dataset , you will get the following error: Error in eval(expr, envir, enclos) : object 'x' not found This can be fixed by using parameter inherit.aes=FALSE which will disable inheriting mapping from ggtree function.", |
186 | 191 |
"title": " inherit aes" |
187 | 192 |
}, |
193 |
+ { |
|
194 |
+ "location": "/faq/#use-in-aes", |
|
195 |
+ "text": "NEVER DO THIS. see the explaination in the ggplot2 book 2ed : Never refer to a variable with $ (e.g., diamonds$carat ) in aes() . This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \\indexc{\\$} see also 1 \nand 2 .", |
|
196 |
+ "title": " use $ in aes" |
|
197 |
+ }, |
|
188 | 198 |
{ |
189 | 199 |
"location": "/faq/#annotation", |
190 | 200 |
"text": "", |
... | ... |
@@ -197,7 +207,7 @@ |
197 | 207 |
}, |
198 | 208 |
{ |
199 | 209 |
"location": "/featuredArticles/", |
200 |
- "text": "Let us know\n if you have published using \nggtree\n and your publication will be featured here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n .rChart {\n display: block;\n margin-left: auto; \n margin-right: auto;\n width: 800px;\n height: 300px;\n } \n \n\n\n\n\n\n\n\n var chartParams = {\n \"element\": \"chartf187d00a00e\",\n\"width\": 800,\n\"height\": 400,\n\"xkey\": \"year\",\n\"ykeys\": [\n \"cites\" \n],\n\"data\": [\n {\n \"year\": 2016,\n\"cites\": 1,\n\"pubid\": \"HtEfBTGE9r8C\" \n} \n],\n\"id\": \"chartf187d00a00e\",\n\"labels\": \"cites\" \n},\n chartType = \"Bar\"\n new Morris[chartType](chartParams)\n\n\n\n\n 2016\n\n\nLack of GLYCOLATE OXIDASE 1, but not GLYCOLATE OXIDASE 2, attenuates the photorespiratory phenotype of CATALASE2-deficient \nArabidopsis\n\n\nPlant Physiology\n May. 2016 \n\n\n\n\nRange overlap drives chromosome inversion fixation in passerine birds\n\n\nbioRxiv\n May. 2016 \nhttp://dx.doi.org/10.1101/053371\n\n\n\n\nPhenotypic and Genotypic Characteristics of Shiga Toxin-Producing Escherichia coli Isolated from Surface Waters and Sediments in a Canadian Urban-Agricultural Landscape\n\n\nFront. Cell. Infect. Microbiol.\n Apr. 2016 \nhttp://dx.doi.org/10.3389%2Ffcimb.2016.00036\n\n\n\n\nWs-2\n Introgression in a Proportion of \nArabidopsis thaliana Col-0\n Stock Seed Produces Specific Phenotypes and Highlights the Importance of Routine Genetic Verification\n\n\nPlant Cell\n Mar. 2016 \nhttp://dx.doi.org/10.1105/tpc.16.00053\n\n\n\n\n 2015\n\n\nThe population genetics of drug resistance evolution in natural populations of viral, bacterial and eukaryotic pathogens\n\n\nMolecuar Ecology\n Dec. 2015 \nhttp://dx.doi.org/10.1111/mec.13474\n\n\n\n\nGenetic characterization of highly pathogenic H5 influenza viruses from poultry in Taiwan, 2015\n\n\nInfection, Genetics and Evolution\n Dec. 2015 \nhttp://dx.doi.org/10.1016/j.meegid.2015.12.006\n\n\n\n\nTrans-species polymorphism at antimicrobial innate immunity cathelicidin genes of Atlantic cod and related species\n\n\nPeerJ\n May 2015 \nhttps://doi.org/10.7717/peerj.976", |
|
210 |
+ "text": "Let us know\n if you have published using \nggtree\n and your publication will be featured here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n .rChart {\n display: block;\n margin-left: auto; \n margin-right: auto;\n width: 800px;\n height: 300px;\n } \n \n\n\n\n\n\n\n\n var chartParams = {\n \"element\": \"chart4057456ed9b\",\n\"width\": 800,\n\"height\": 400,\n\"xkey\": \"year\",\n\"ykeys\": [\n \"cites\" \n],\n\"data\": [\n {\n \"year\": 2016,\n\"cites\": 1,\n\"pubid\": \"HtEfBTGE9r8C\" \n} \n],\n\"id\": \"chart4057456ed9b\",\n\"labels\": \"cites\" \n},\n chartType = \"Bar\"\n new Morris[chartType](chartParams)\n\n\n\n\n 2016\n\n\nLack of GLYCOLATE OXIDASE 1, but not GLYCOLATE OXIDASE 2, attenuates the photorespiratory phenotype of CATALASE2-deficient \nArabidopsis\n\n\nPlant Physiology\n May. 2016 \n\n\n\n\nRange overlap drives chromosome inversion fixation in passerine birds\n\n\nbioRxiv\n May. 2016 \nhttp://dx.doi.org/10.1101/053371\n\n\n\n\nPhenotypic and Genotypic Characteristics of Shiga Toxin-Producing Escherichia coli Isolated from Surface Waters and Sediments in a Canadian Urban-Agricultural Landscape\n\n\nFront. Cell. Infect. Microbiol.\n Apr. 2016 \nhttp://dx.doi.org/10.3389%2Ffcimb.2016.00036\n\n\n\n\nWs-2\n Introgression in a Proportion of \nArabidopsis thaliana Col-0\n Stock Seed Produces Specific Phenotypes and Highlights the Importance of Routine Genetic Verification\n\n\nPlant Cell\n Mar. 2016 \nhttp://dx.doi.org/10.1105/tpc.16.00053\n\n\n\n\n 2015\n\n\nThe population genetics of drug resistance evolution in natural populations of viral, bacterial and eukaryotic pathogens\n\n\nMolecuar Ecology\n Dec. 2015 \nhttp://dx.doi.org/10.1111/mec.13474\n\n\n\n\nGenetic characterization of highly pathogenic H5 influenza viruses from poultry in Taiwan, 2015\n\n\nInfection, Genetics and Evolution\n Dec. 2015 \nhttp://dx.doi.org/10.1016/j.meegid.2015.12.006\n\n\n\n\nTrans-species polymorphism at antimicrobial innate immunity cathelicidin genes of Atlantic cod and related species\n\n\nPeerJ\n May 2015 \nhttps://doi.org/10.7717/peerj.976", |
|
201 | 211 |
"title": "Featured Articles" |
202 | 212 |
}, |
203 | 213 |
{ |
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
|
5 | 5 |
<url> |
6 | 6 |
<loc>https://guangchuangyu.github.io/ggtree/</loc> |
7 |
- <lastmod>2016-12-08</lastmod> |
|
7 |
+ <lastmod>2016-12-09</lastmod> |
|
8 | 8 |
<changefreq>daily</changefreq> |
9 | 9 |
</url> |
10 | 10 |
|
... | ... |
@@ -12,7 +12,7 @@ |
12 | 12 |
|
13 | 13 |
<url> |
14 | 14 |
<loc>https://guangchuangyu.github.io/ggtree/documentation/</loc> |
15 |
- <lastmod>2016-12-08</lastmod> |
|
15 |
+ <lastmod>2016-12-09</lastmod> |
|
16 | 16 |
<changefreq>daily</changefreq> |
17 | 17 |
</url> |
18 | 18 |
|
... | ... |
@@ -20,7 +20,7 @@ |
20 | 20 |
|
21 | 21 |
<url> |
22 | 22 |
<loc>https://guangchuangyu.github.io/ggtree/faq/</loc> |
23 |
- <lastmod>2016-12-08</lastmod> |
|
23 |
+ <lastmod>2016-12-09</lastmod> |
|
24 | 24 |
<changefreq>daily</changefreq> |
25 | 25 |
</url> |
26 | 26 |
|
... | ... |
@@ -28,7 +28,7 @@ |
28 | 28 |
|
29 | 29 |
<url> |
30 | 30 |
<loc>https://guangchuangyu.github.io/ggtree/featuredArticles/</loc> |
31 |
- <lastmod>2016-12-08</lastmod> |
|
31 |
+ <lastmod>2016-12-09</lastmod> |
|
32 | 32 |
<changefreq>daily</changefreq> |
33 | 33 |
</url> |
34 | 34 |
|
... | ... |
@@ -37,49 +37,49 @@ |
37 | 37 |
|
38 | 38 |
<url> |
39 | 39 |
<loc>https://guangchuangyu.github.io/ggtree/ChIPseeker/</loc> |
40 |
- <lastmod>2016-12-08</lastmod> |
|
40 |
+ <lastmod>2016-12-09</lastmod> |
|
41 | 41 |
<changefreq>daily</changefreq> |
42 | 42 |
</url> |
43 | 43 |
|
44 | 44 |
<url> |
45 | 45 |
<loc>https://guangchuangyu.github.io/ggtree/clusterProfiler/</loc> |
46 |
- <lastmod>2016-12-08</lastmod> |
|
46 |
+ <lastmod>2016-12-09</lastmod> |
|
47 | 47 |
<changefreq>daily</changefreq> |
48 | 48 |
</url> |
49 | 49 |
|
50 | 50 |
<url> |
51 | 51 |
<loc>https://guangchuangyu.github.io/ggtree/DOSE/</loc> |
52 |
- <lastmod>2016-12-08</lastmod> |
|
52 |
+ <lastmod>2016-12-09</lastmod> |
|
53 | 53 |
<changefreq>daily</changefreq> |
54 | 54 |
</url> |
55 | 55 |
|
56 | 56 |
<url> |
57 | 57 |
<loc>https://guangchuangyu.github.io/ggtree/emojifont/</loc> |
58 |
- <lastmod>2016-12-08</lastmod> |
|
58 |
+ <lastmod>2016-12-09</lastmod> |
|
59 | 59 |
<changefreq>daily</changefreq> |
60 | 60 |
</url> |
61 | 61 |
|
62 | 62 |
<url> |
63 | 63 |
<loc>https://guangchuangyu.github.io/ggtree/ggtree/</loc> |
64 |
- <lastmod>2016-12-08</lastmod> |
|
64 |
+ <lastmod>2016-12-09</lastmod> |
|
65 | 65 |
<changefreq>daily</changefreq> |
66 | 66 |
</url> |
67 | 67 |
|
68 | 68 |
<url> |
69 | 69 |
<loc>https://guangchuangyu.github.io/ggtree/GOSemSim/</loc> |
70 |
- <lastmod>2016-12-08</lastmod> |
|
70 |
+ <lastmod>2016-12-09</lastmod> |
|
71 | 71 |
<changefreq>daily</changefreq> |
72 | 72 |
</url> |
73 | 73 |
|
74 | 74 |
<url> |
75 | 75 |
<loc>https://guangchuangyu.github.io/ggtree/meshes/</loc> |
76 |
- <lastmod>2016-12-08</lastmod> |
|
76 |
+ <lastmod>2016-12-09</lastmod> |
|
77 | 77 |
<changefreq>daily</changefreq> |
78 | 78 |
</url> |
79 | 79 |
|
80 | 80 |
<url> |
81 | 81 |
<loc>https://guangchuangyu.github.io/ggtree/ReactomePA/</loc> |
82 |
- <lastmod>2016-12-08</lastmod> |
|
82 |
+ <lastmod>2016-12-09</lastmod> |
|
83 | 83 |
<changefreq>daily</changefreq> |
84 | 84 |
</url> |
85 | 85 |
|
... | ... |
@@ -50,6 +50,26 @@ This is because the units are in two different spaces (data and pixel). Users ca |
50 | 50 |
ggtree(tree) + geom_tiplab() + xlim(0, 0.06) |
51 | 51 |
``` |
52 | 52 |
|
53 |
+## <i class="fa fa-angle-double-right"></i> Modify (tip) labels |
|
54 |
+ |
|
55 |
+This could be easily done via the `%<+%` operator to attach the |
|
56 |
+modified version of the labels and than use `geom_tiplab` to display |
|
57 |
+the modified version. |
|
58 |
+ |
|
59 |
+ |
|
60 |
+``` |
|
61 |
+raxml_file <- system.file("extdata/RAxML", "RAxML_bipartitionsBranchLabels.H3", package="ggtree") |
|
62 |
+raxml <- read.raxml(raxml_file) |
|
63 |
+ |
|
64 |
+lb = get.tree(raxml)$tip.label |
|
65 |
+d = data.frame(label=lb, label2 = paste("AA", substring(lb, 1, 5))) |
|
66 |
+ggtree(raxml) %<+% d + geom_tiplab(aes(label=label2)) |
|
67 |
+``` |
|
68 |
+ |
|
69 |
+see also |
|
70 |
+[1](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/tFdFgCJ7gQA/tZ6phSgUDQAJ) |
|
71 |
+and [2](https://github.com/GuangchuangYu/ggtree/issues/106). |
|
72 |
+ |
|
53 | 73 |
## <i class="fa fa-angle-double-right"></i> Formatting (tip) labels |
54 | 74 |
|
55 | 75 |
If you want to format labels, you need to set `parse=TRUE` in `geom_text`/`geom_tiplab` and the `label` should be string that can be parsed into expression and displayed as described in `?plotmath`. |
... | ... |
@@ -122,6 +142,18 @@ Error in eval(expr, envir, enclos) : object 'x' not found |
122 | 142 |
|
123 | 143 |
This can be fixed by using parameter `inherit.aes=FALSE` which will disable inheriting mapping from `ggtree` function. |
124 | 144 |
|
145 |
+## <i class="fa fa-angle-double-right"></i> use `$` in aes |
|
146 |
+ |
|
147 |
+NEVER DO THIS. |
|
148 |
+ |
|
149 |
+see the explaination in the [ggplot2 book 2ed](https://github.com/hadley/ggplot2-book/blob/master/layers.rmd#aesthetic-mappings-secaes): |
|
150 |
+ |
|
151 |
+>Never refer to a variable with `$` (e.g., `diamonds$carat`) in `aes()`. This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \indexc{\$} |
|
152 |
+ |
|
153 |
+see also |
|
154 |
+[1](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/hViM6vRZF94/MsZT8qRgBwAJ) |
|
155 |
+and [2](https://github.com/GuangchuangYu/ggtree/issues/106). |
|
156 |
+ |
|
125 | 157 |
|
126 | 158 |
# <i class="fa fa-tree"></i> Annotation |
127 | 159 |
|
... | ... |
@@ -36,10 +36,10 @@ |
36 | 36 |
} |
37 | 37 |
</style> |
38 | 38 |
|
39 |
-<div id = 'chartf187d00a00e' class = 'rChart morris'></div> |
|
39 |
+<div id = 'chart4057456ed9b' class = 'rChart morris'></div> |
|
40 | 40 |
<script type='text/javascript'> |
41 | 41 |
var chartParams = { |
42 |
- "element": "chartf187d00a00e", |
|
42 |
+ "element": "chart4057456ed9b", |
|
43 | 43 |
"width": 800, |
44 | 44 |
"height": 400, |
45 | 45 |
"xkey": "year", |
... | ... |
@@ -53,7 +53,7 @@ |
53 | 53 |
"pubid": "HtEfBTGE9r8C" |
54 | 54 |
} |
55 | 55 |
], |
56 |
-"id": "chartf187d00a00e", |
|
56 |
+"id": "chart4057456ed9b", |
|
57 | 57 |
"labels": "cites" |
58 | 58 |
}, |
59 | 59 |
chartType = "Bar" |
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
|
17 | 17 |
<link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"> |
18 | 18 |
|
19 |
-[](https://bioconductor.org/packages/ggtree) |
|
19 |
+[](https://bioconductor.org/packages/ggtree) |
|
20 | 20 |
[](https://github.com/GuangchuangYu/ggtree) |
21 | 21 |
[](https://bioconductor.org/packages/stats/bioc/ggtree) |
22 | 22 |
[](https://bioconductor.org/packages/stats/bioc/ggtree) |
... | ... |
@@ -37,6 +37,26 @@ This is because the units are in two different spaces (data and pixel). Users ca |
37 | 37 |
ggtree(tree) + geom_tiplab() + xlim(0, 0.06) |
38 | 38 |
``` |
39 | 39 |
|
40 |
+## <i class="fa fa-angle-double-right"></i> Modify (tip) labels |
|
41 |
+ |
|
42 |
+This could be easily done via the `%<+%` operator to attach the |
|
43 |
+modified version of the labels and than use `geom_tiplab` to display |
|
44 |
+the modified version. |
|
45 |
+ |
|
46 |
+ |
|
47 |
+``` |
|
48 |
+raxml_file <- system.file("extdata/RAxML", "RAxML_bipartitionsBranchLabels.H3", package="ggtree") |
|
49 |
+raxml <- read.raxml(raxml_file) |
|
50 |
+ |
|
51 |
+lb = get.tree(raxml)$tip.label |
|
52 |
+d = data.frame(label=lb, label2 = paste("AA", substring(lb, 1, 5))) |
|
53 |
+ggtree(raxml) %<+% d + geom_tiplab(aes(label=label2)) |
|
54 |
+``` |
|
55 |
+ |
|
56 |
+see also |
|
57 |
+[1](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/tFdFgCJ7gQA/tZ6phSgUDQAJ) |
|
58 |
+and [2](https://github.com/GuangchuangYu/ggtree/issues/106). |
|
59 |
+ |
|
40 | 60 |
## <i class="fa fa-angle-double-right"></i> Formatting (tip) labels |
41 | 61 |
|
42 | 62 |
If you want to format labels, you need to set `parse=TRUE` in `geom_text`/`geom_tiplab` and the `label` should be string that can be parsed into expression and displayed as described in `?plotmath`. |
... | ... |
@@ -109,6 +129,18 @@ Error in eval(expr, envir, enclos) : object 'x' not found |
109 | 129 |
|
110 | 130 |
This can be fixed by using parameter `inherit.aes=FALSE` which will disable inheriting mapping from `ggtree` function. |
111 | 131 |
|
132 |
+## <i class="fa fa-angle-double-right"></i> use `$` in aes |
|
133 |
+ |
|
134 |
+NEVER DO THIS. |
|
135 |
+ |
|
136 |
+see the explaination in the [ggplot2 book 2ed](https://github.com/hadley/ggplot2-book/blob/master/layers.rmd#aesthetic-mappings-secaes): |
|
137 |
+ |
|
138 |
+>Never refer to a variable with `$` (e.g., `diamonds$carat`) in `aes()`. This breaks containment, so that the plot no longer contains everything it needs, and causes problems if ggplot2 changes the order of the rows, as it does when facetting. \indexc{\$} |
|
139 |
+ |
|
140 |
+see also |
|
141 |
+[1](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/hViM6vRZF94/MsZT8qRgBwAJ) |
|
142 |
+and [2](https://github.com/GuangchuangYu/ggtree/issues/106). |
|
143 |
+ |
|
112 | 144 |
|
113 | 145 |
# <i class="fa fa-tree"></i> Annotation |
114 | 146 |
|