R/fct_plot_downloads.R

Defines functions plot_downloads

Documented in plot_downloads

#' Shiny download ggplot
#'
#' @param curv2plot ggplot to plot
#' @import grDevices
#' @return function for download ggplot
#' @export
plot_downloads <- function(curv2plot) {
  filename <- file <- NULL
  downloadHandler(
    filename = function() {
      paste(Sys.Date(), "_kv_plot", ".png", sep="")
    },
    content = function(file) {
      grDevices::png(file,
                     width = 960,
                     height = 480,
                     units = "px",
                     pointsize = 24)
      plot(curv2plot)
      dev.off()
    }
  )
}
ratral/gpvapp documentation built on May 13, 2022, 12:51 a.m.