Coder Social home page Coder Social logo

Comments (6)

vnijs avatar vnijs commented on July 20, 2024

Don't have an answer for this one. I'm not sure it is possible to download svg plots or include them in knitr documents at this time. You can include them if you use rmarkdown but that doesn't help much in a shiny app. A couple of relevant discussions:

rich-iannone/DiagrammeR#70

yihui/knitr#754

from radiant.

kmezhoud avatar kmezhoud commented on July 20, 2024

@vnijs Thank You.

from radiant.

vnijs avatar vnijs commented on July 20, 2024

Link to review:

http://stackoverflow.com/questions/31645528/knit-dtdatatable-without-pandoc/31797947#31797947

Others:

http://blog.dominodatalab.com/interactive-dashboards-with-knitr-and-html-widgets/

http://stackoverflow.com/questions/21729415/generate-dynamic-r-markdown-blocks/33222656#33222656

http://stackoverflow.com/questions/33212428/automatically-saving-interactive-graph-in-r-to-a-specified-location-as-a-html-f/33212516#33212516

http://stackoverflow.com/questions/28585238/r-rendering-html-widget-in-external-browser

https://support.rstudio.com/hc/communities/public/questions/202578368-Rendering-HTML-widget-in-external-browser

from radiant.

kmezhoud avatar kmezhoud commented on July 20, 2024

Hi @vnijs,
thank you for all links. They are useful. I can now save diagrams as html. not bad.
server.R

output$Save_diagrammeR_plot <- downloadHandler(
  filename = function() {
    paste(getwd(),"DiagrammeRplot.html", sep="/")
  },
  content = function(file) {
    saveWidget(  
DiagrammeR::grViz("
    digraph{
      BRCA1  -> IFI16   [arrowhead = normal, color= LightGray, alpha=30, penwidth= 0.2] ;
      BRCA1  ->   NBN [arrowhead = normal] ;
      BRCA1  ->  TP53   [color= LightGray] ;
      IFI16  ->  TP53 [arrowtail = normal] ;
      PML  ->  TP53 [arrowtail = normal]
  },
  engine = neato,   #dot, neato|twopi|circo|
  width = 1200
"), file)
  }

 # browseURL(paste('file://',getwd(),"Reactomeplot.html", sep="/"))
  ## wait 1 sd before delete
  # p1 <- proc.time()
  # Sys.sleep(1)
  # proc.time() - p1
## delete file
  #,unlink(paste(getwd(),"DiagrammeRplot.html", sep="/"))
)

ui.R

downloadButton('Save_diagrammeR_plot', 'HTML')

from radiant.

vnijs avatar vnijs commented on July 20, 2024

Hi @ramnathv

Here are some links i mentioned

from radiant.

vnijs avatar vnijs commented on July 20, 2024

You could try https://github.com/rich-iannone/DiagrammeRsvg for convert a DiagrammeR plot to pdf or png. It requires V8 however and I don't want to add that dependency at this time. I added a function to the report feature so you can include diagrammer plots when you save the report to HTML. Looks like it will take some time before there is a convenient solution for this problem so I'll close this issue for now. Unless @ramnathv has suggestions?

https://github.com/vnijs/radiant/blob/master/inst/base/tools/app/report.R#L131-L177

from radiant.

Related Issues (20)

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.