View source: R/mod_download_figure.R
mod_download_figure_server | R Documentation |
The server function of the shiny module that works with
mod_download_figure_ui()
to automatically download figures from
within a shiny application. The server function handles the UI for the
pop-up and code for downloading the plot as PDF, PNG, or SVG. This works for
both ggplot2 graphics and base R plots. Base R plots must be save in an
object with recordPlot()
.
mod_download_figure_server( id, filename, figure, width = 8, height = 6, label = "Download Plot" )
id |
String to identify namespace as an internal parameter for shiny. |
filename |
The name of file that plot should be saved as |
figure |
The plot to be downloaded. Should be wrapped in a reactive function |
width |
Width (inches) the plot should be saved as. Default is 8 in and must be a value between 2 and 30. |
height |
Height (inches) the plot should be saved as. Default is 6 in and must be a value between 2 and 30. |
label |
Character string denoting the label for the download button. Default is "Download plot" |
shiny server function for download pop-up modal
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.