Description Usage Arguments Value Examples
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.
1 2 3 4 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
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()
})
}
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.