Create a ui that contains controls for the height and width of the plot as
well as a downloadButton. The module uses ggsave to convert the plot
into an image file.
ggDownload(input, output, session, plotObj, plotObjName = "ggObj") ggDownloadUI(id, downloadText = "Download image file", previewText = "Open in new tab")
| input, output, session | Standard module parameters |
|---|---|
| plotObj | A reactive |
| plotObjName | The name of the object in the resulting code |
| id | The module identifier. |
| downloadText | Text do display on the |
| previewText | Text to display in the preview button. |
A reactive string that represents the code for downloading the plot.
if (FALSE) { library(ggplot2) gg <- ggplot(mtcars, aes(wt, mpg)) + geom_point() shinyApp( fluidPage( ggDownloadUI("ggd"), codeOutput("code") ), function(input, output, session){ code <- callModule(ggDownload, "ggd", reactive({gg})) output$code <- renderCode({ code() }) } ) }