0

*** This is the program ***

library(htmlwidgets)
library(plotly)
library(shiny)
library(webshot)

server<-function(input, output){
  
  # fig<-plot_ly(data=iris,x=~Sepal.Length,y=~Petal.Length)
  # fig
  
  output$boton1<-downloadHandler(
    
    filename=function() {
      paste0("check.png")
    },
    content=function(file) {
      
      fig<-plot_ly(data=iris,x=~Sepal.Length,y=~Petal.Length)
      fig
      
      saveWidget(fig,"check.html")
      webshot("check.html",file=file)
    }
  )
      
}

    ui <- fluidPage(
  downloadButton("boton1","Save png as:"),
  br(),
  plotlyOutput("plot1")
)

*** This is the error that i get in shinyapps.io ***

Error getting logs: Internal Server Error

R/Shiny. Problem with deploy. Saving a png in downloadHandler with webshot and plotly. It works local. Does not work when i am deploying

  • See here for a solution without webshot: https://stackoverflow.com/a/53317200/1100107 – Stéphane Laurent Apr 30 '22 at 10:57
  • Hello, thanks for the answer but t I need a solution with my code. What is worng? Why is this code not working in shinyapps.io and is working in R studio locally? That is my question. I need to use webshot, not other package or function. – Diego Bouzas Apr 30 '22 at 11:32
  • Thanks a lot Stephane, your are great. I got it now. Diego – Diego Bouzas Apr 30 '22 at 12:31

0 Answers0