View source: R/downloadablePlot.R
downloadablePlot | R Documentation |
Download button appears on hover in top right.
downloadablePlot(input, output, session, plot, filename, content, ...)
input, output, session |
standard |
plot |
A |
filename |
A string of the filename, including extension, that the user's web browser should default to when downloading the file; or a function that returns such a string. (Reactive values and functions may be used from this function.) |
content |
A function that takes a single argument |
... |
additional named arguments passed to |
No return value, called to generate server logic.
downloadablePlotUI
, renderPlot
.
library(shiny) library(shinyjs) library(shinydlplot) library(ggplot2) ui <- fluidPage( useShinyjs(), downloadablePlotUI(id = 'iris_plot') ) server <- function(input, output, session) { plot <- ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) + geom_point() callModule(downloadablePlot, id = 'iris_plot', plot = plot, filename = 'iris.csv', content = function(file) {write.csv(iris, file)}) } ## Not run: shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.