Skip to content

Instantly share code, notes, and snippets.

@zhanxw
Created April 5, 2018 16:43
Show Gist options
  • Save zhanxw/53535761516c0641d734707733518e96 to your computer and use it in GitHub Desktop.
Save zhanxw/53535761516c0641d734707733518e96 to your computer and use it in GitHub Desktop.
geom_hilight() does not work
library(ggtree)
# load a tree
# tree <- treeio::read.tree("phylotree.nwk")
# this is eqivalent to:
tree <- structure(list(edge = structure(c(14L, 15L, 16L, 15L, 17L, 17L,
17L, 15L, 18L, 18L, 18L, 15L, 19L, 15L, 20L, 15L, 15L, 15L, 14L,
21L, 15L, 16L, 1L, 17L, 2L, 3L, 4L, 18L, 5L, 6L, 7L, 19L, 8L,
20L, 9L, 10L, 11L, 12L, 21L, 13L), .Dim = c(20L, 2L)), Nnode = 8L,
node.label = c("Root", "k__Bacteria", "p__Bacteroidetes",
"p__Firmicutes", "p__Proteobacteria", "p__Actinobacteria",
"p__Fusobacteria", "k__Viruses"), tip.label = c("c__Bacteroidia",
"c__Negativicutes", "c__Bacilli", "c__Clostridia", "c__Betaproteobacteria",
"c__Gammaproteobacteria", "c__Epsilonproteobacteria", "c__Actinobacteria",
"c__Fusobacteriia", "p__Spirochaetes", "p__Candidatus_Saccharibacteria",
"p__Synergistetes", "p__Viruses_noname")), .Names = c("edge",
"Nnode", "node.label", "tip.label"), class = "phylo", order = "cladewise")
# show internal nodes
ggtree(tree, layout= "circular") + geom_text2(aes(subset=!isTip, label=node), hjust=-.3) + geom_tiplab()
# why there is no highlight?
ggtree(tree, layout= "circular") + geom_hilight(node = 16)
# show internal nodes
ggtree(tree) + geom_text2(aes(subset=!isTip, label=node), hjust=-.3) + geom_tiplab()
# why there is no highlight?
ggtree(tree) + geom_hilight(node = 16)
@zhanxw
Copy link
Author

zhanxw commented Apr 5, 2018

r$> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] ggtree_1.10.5 treeio_1.2.2 ggplot2_2.2.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 lattice_0.20-35 ape_5.0 tidyr_0.8.0 grid_3.4.4 plyr_1.8.4 jsonlite_1.5 nlme_3.1-131.1 gtable_0.2.0 magrittr_1.5
[11] scales_0.5.0 pillar_1.2.1 rlang_0.2.0 lazyeval_0.2.1 rvcheck_0.0.9 labeling_0.3 glue_1.2.0 purrr_0.2.4 munsell_0.4.3 parallel_3.4.4
[21] compiler_3.4.4 colorspace_1.3-2 tibble_1.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment