Skip to content

YuLab-SMU/iggtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iggtree: Provide basic components for the interactive version of 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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published