Use phylocanvas to draw phylogenetic trees. Basic options to control the tree are availalbe in this top level function. The tree shape in controlled by the
treetype option. Try ‘radial’ and ‘heirarchical’ as well.
library(phylocanvas) library(dplyr) phycanv <- phylocanvas("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;", treetype = "rectangular", alignlabels = T)
phycircle <- phylocanvas("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;", treetype = "circular", nodesize = 30, linewidth = 10) phycircle
Node styling options are available. Most of the appearance of a node can be changed here. Note below that colors can be either colornames, rgb strings or hex strings.
phycircle %>% collapse_branch("E")
phycircle %>% rotate_branch("E")
phycanv %>% highlight_node("B")
Phylocanvas has a nubmer of different plugins that extend the basic tree. These include pluings ofr metadata, scale bars, svg export, context menu on the mouse, and history. We will try to add as many as reasonable. Currently this htmlwidget sis based on the phylocanvas-quickstart so we can activate the history, context, scale, and metadata features.
# Note the scalebar is active phylocanvas("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;", showscalebar = TRUE)
Not expecting 1:1 parity with the pure JS version. The goal is to expose the basic styling and sizing to allow easy tree drawing within R. Possibly, to use the metadata plugin for heatmap displays and ideally (don’t know how hard this will be) allow drag and drop selection for returnign sequence names into shiny.