YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/treedata-book/
821 stars 172 forks source link

geom_hilight does not highlight the whole clade #585

Open BioinfoNovice opened 11 months ago

BioinfoNovice commented 11 months ago

I'm running this example code to use geom_hilight :

library(ggtree) set.seed(102) tree <- rtree(60) dat <- data.frame(id=c(62, 88), type=c("A", "B")) p <- ggtree(tree) + geom_hilight(data=dat, mapping=aes(node = id, fill=type), alpha=1) p

The clades are not highlighted as expected but only the branch pointing respective node... This is quite weird. I have some experience using ggtree. I've never seen this.

Thank you in advance!

faa09a51-9995-40eb-974b-a0406a5ae340

RosaLuzia commented 10 months ago

I have the same problem!

dr-budd commented 10 months ago

I ran your code and the highlighted area looks as it should. Which version of ggtree are you running?

library(ggtree) set.seed(102) tree <- rtree(60) dat <- data.frame(id=c(62, 88), type=c("A", "B")) p <- ggtree(tree) + geom_hilight(data=dat, mapping=aes(node = id, fill=type), alpha=1) p

test

sessionInfo() R version 4.1.3 (2022-03-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS 13.2.1

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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_3.2.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.9 pillar_1.9.0 compiler_4.1.3 yulab.utils_0.0.6 [5] tools_4.1.3 digest_0.6.31 aplot_0.2.0 jsonlite_1.8.4
[9] tidytree_0.4.2 lifecycle_1.0.3 tibble_3.2.1 nlme_3.1-161
[13] gtable_0.3.4 lattice_0.20-45 pkgconfig_2.0.3 rlang_1.1.1
[17] DBI_1.1.3 cli_3.6.1 ggplotify_0.1.0 rstudioapi_0.14
[21] patchwork_1.1.3 parallel_4.1.3 treeio_1.23.0 withr_2.5.0
[25] dplyr_1.1.3 generics_0.1.3 vctrs_0.6.3 gridGraphics_0.5-1 [29] grid_4.1.3 tidyselect_1.2.0 glue_1.6.2 R6_2.5.1
[33] fansi_1.0.4 farver_2.1.1 ggplot2_3.4.3 tidyr_1.3.0
[37] purrr_1.0.2 magrittr_2.0.3 scales_1.2.1 ape_5.7-1
[41] colorspace_2.1-0 labeling_0.4.2 utf8_1.2.3 lazyeval_0.2.2
[45] munsell_0.5.0 ggfun_0.1.2

xiangpin commented 10 months ago

Did you try re-install ggtree using BiocManager::install("ggtree", force=T, type = 'source') ?

ammaraziz commented 8 months ago

I think this was a bug in v3.9 of ggtree. I am on macos (M1). After upgrading to v3.10 using the above command it's now working.