https://github.com/uscbiostats/jsphylosvg
htmlwidgets for the jsPhyloSVG javascript library
https://github.com/uscbiostats/jsphylosvg
htmlwidgets phylogenetic-trees phylogenetics r rpackage rstats
Last synced: about 2 months ago
JSON representation
htmlwidgets for the jsPhyloSVG javascript library
- Host: GitHub
- URL: https://github.com/uscbiostats/jsphylosvg
- Owner: USCbiostats
- License: other
- Created: 2017-12-08T01:26:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-15T00:58:15.000Z (almost 8 years ago)
- Last Synced: 2025-04-28T14:45:24.591Z (5 months ago)
- Topics: htmlwidgets, phylogenetic-trees, phylogenetics, r, rpackage, rstats
- Language: JavaScript
- Homepage: https://uscbiostats.github.io/jsPhyloSVG/
- Size: 497 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output:
- github_document
- html_document
always_allow_html: yes
theme: journal
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "70%"
)
```
# jsPhyloSVG htmlwidgetThe [jsPhyloSVG](http://jsphylosvg.com) javascript library provides a neat visualization tool for phylogenetic trees. This R package, which has the same name, is a wrapper that builds an [htmlwidget](http://www.htmlwidgets.org/) that allows its use in R, including RMarkdown and Shiny. This is still work in progress.
## Installation
You can install jsPhyloSVG from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("USCBiostats/jsPhyloSVG")
```## Example
In the following, we present an example of usage of the widget. First, using the [ape](https://cran.r-project.org/package=ape) package, we create a random phylogenetic tree.
```{r loading-packages}
library(ape)
library(jsPhyloSVG)
``````{r random-tree}
x <- rtree(10)
```Using the `plot.ape` method, we can get a nice tree drawn with ape:
```{r ape-plot}
plot(x)
```Using the `jsPhyloSVG` function, we can visualize the same tree but using the Javascript library of the same name, [jsPhyloSVG](http://jsphylosvg.com):
```{r}
jsPhyloSVG(write.tree(x), width = 500)
```