save-ggplot-module {esquisse} | R Documentation |
Save ggplot
module
Description
Save a ggplot
object in various format and resize it before saving.
Usage
save_ggplot_ui(
id,
output_format = c("png", "pdf", "svg", "jpeg", "bmp", "eps", "tiff")
)
save_ggplot_modal(
id,
title = NULL,
output_format = c("png", "pdf", "svg", "jpeg", "bmp", "eps", "tiff")
)
save_ggplot_server(id, plot_rv)
Arguments
id |
Module ID. |
output_format |
Output formats offered to the user. |
title |
Modal's title. |
plot_rv |
A |
Value
No value. Use in UI & server of shiny application.
Examples
library(shiny)
library(ggplot2)
library(esquisse)
ui <- fluidPage(
tags$h2("Save a ggplot"),
selectInput("var", "Variable:", names(economics)[-1]),
plotOutput("plot", width = "600px"),
actionButton("save", "Save this plot")
)
server <- function(input, output, session) {
rv <- reactiveValues(plot = NULL)
output$plot <- renderPlot({
rv$plot <- ggplot(economics) +
geom_line(aes(date, !!sym(input$var))) +
theme_minimal()
rv$plot
})
observeEvent(input$save, {
save_ggplot_modal("ID", "Save plot")
})
save_ggplot_server("ID", rv)
}
if (interactive())
shinyApp(ui, server)
[Package esquisse version 2.0.0 Index]