I have a ggplotly object called p2 in my shiny app. I want it to work where if a user presses a downloadButton in the app UI, it will download the ggplotly plot as an html file. But the function doesn't work:
output$Export_Graph <- downloadHandler(
filename = function() {
file <- "Graph"
},
content = function(file) {
write(p2, file)
}
Any ideas?
An interactive plotly graph can be exported as an "html widget". A minimal sample code is like the following:
Note: Before run the code, pandoc have to be installed. See http://pandoc.org/installing.html