Giter VIP home page Giter VIP logo

phylocanvas's Introduction

phylocanvas

CRAN_Status_Badge

Use phylocanvas to draw phylogenetic trees in the browser. 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.

Installation

You can install phylocanvas from github with:

install.packages("phylocanvas")

Example

This is a basic example which shows you how to solve a common problem:

install.packages("phylocanvas")

tree <- ape::read.tree("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;")

phycanv <- phylocanvas(tree,treetype = "rectangular", alignlabels = T)

# stylize nodes
phycanv %>%
  style_node("A", nodesizeratio = 4, fillcolor="rgb(0, 255, 0)") %>% 
  style_node("B", fillcolor = "blue") %>%
  style_node("C", labeltextsize = 10, shape="triangle") %>%
  style_node("D", fillcolor="#ffa500", highlighted=TRUE) 

Latest Information

See the documentation webpage fot the latest information.

Roadmap

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.

Reference

The sourcecode for the phylocanvas htmltools package can be found at the github repo. For more information about the phylocanvas JavaScript library, check out the phylocanvas website.

phylocanvas's People

Contributors

zachcp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

phylocanvas's Issues

Redraw of plots with shiny

Hi,

I'm trying to use phylocanvas with shiny but each time I change a parameter and redraw the plot, it renders it as a new plot below the previous one (instead of replacing it).

require(shiny)
require(phylocanvas)
require(ape)

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      sliderInput("nodes_in",
                  "Number of nodes",
                  min = 1, max = 50, value = 30)
    ),
    mainPanel(
      phylocanvasOutput("phy_test")
    )
  )
)

server <- function(input, output) {
  output$phy_test <- renderPhylocanvas({ #env = parent.frame(1), quoted = T
    tree <- rtree(n = input$nodes_in)
    phycanv <- phylocanvas(tree)
    phycanv
  })
}

shinyApp(ui = ui, server = server)

About Ouput file created after writing Phylocanvas

Hello Zachcp.
I found the following problem while using your package.

**> TTT <- phylocanvas(test_tree2, treetype = "hierarchical", nodestyles = 2,
nodesize = 20, textsize = 30, linewidth = 2, showlabels = TRUE,
alignlabels = TRUE, showhistory = FALSE, showcontextmenu = TRUE,
showscalebar = TRUE, width = "100%", height = "800px", elementId = NULL)

htmlwidgets::saveWidget(as_widget(TTT),` "tttest7.html")**

The created html completely created the tree I wanted.
If you right-click the generated html file, you can use the following functions.
Among the features, I really liked the feature called "Export as Image", and when I used it, I was a little sad.
The downloaded image was painted very dark, showing the tree slightly darker in it.
phylocanvas

I know it's been 5 years since you wrote the script.
If you see this article, please reply to see if you can help with this part.
Thanks in advance for your advice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.