mod_download_figure_server: download_figure Server Functions

View source: R/mod_download_figure.R

mod_download_figure_serverR Documentation

download_figure Server Functions

Description

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().

Usage

mod_download_figure_server(
  id,
  filename,
  figure,
  width = 8,
  height = 6,
  label = "Download Plot"
)

Arguments

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"

Value

shiny server function for download pop-up modal


espors/ottoPlots documentation built on Dec. 1, 2022, 6:52 a.m.