Skip to contents

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)

Arguments

id, input, output, session

Internal parameters 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.