Skip to content
This repository was archived by the owner on Oct 9, 2026. It is now read-only.
YuLab-SMUPublic archive

About

interactive ggtree with ggiraph

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

iggtree: Provide basic components for the interactive version of ggtree

incorporated in ggtree

📰 Description

Provides functions to render ‘ggtree’ objects as interactive graphics using the ‘ggiraph’ package. Adds support for interactive tooltips, data point selection, and click events to phylogenetic trees.

✍️ Author

Shuangbin Xu and Guangchuang Yu

School of Basic Medical Sciences, Southern Medical University

⏬ Installation

#It can be installed via GitHub.
if (!requireNamespace("remotes", quietly=TRUE))
    install.packages("remotes")
remotes::install_github("YuLab-SMU/iggtree")

🔰 Usage

library(ggplot2)
library(ggiraph)
library(iggtree)
# Note: the ggtree should be re-installed via
# remotes::install_github("xiangpin/ggtree@use_iggtree_ggiraph")
library(ggtree)

set.seed(123)
tr <- rtree(20)
dt <- data.frame(id = c(36, 38), type=c("A", "B"))
p <- ggtree(
       tr, 
       mapping = aes(
           tooltip = round(branch.length, 2), 
           data_id = node
         )
     ) +
     geom_hilight(
        data = dt, 
        mapping = aes(
           node = id, 
           fill = type, 
           tooltip = paste0("clade of node ", id), 
           data_id = type
        ), 
        to.bottom = TRUE
     )

girafe(ggobj = p)

💖 Contributing

We welcome any contributions! By participating in this project you agree to abide by the terms outlined in the Contributor Code of Conduct.

About

interactive ggtree with ggiraph

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages