encodePlot {shinylight}R Documentation

Renders a plot as a base64-encoded image

Description

Renders a plot as a base64-encoded image

Usage

encodePlot(device, mimeType, width, height, plotFn)

Arguments

device

Graphics device function, such as grDevices::png or grDevices::pdf

mimeType

Mime type for the data produced by device

width

Width of the plot in units applicable to device

height

Height of the plot in units applicable to device

plotFn

Function to call to perform the plot

Value

list with two keys, whose values can each be NULL: 'plot' is a plot in HTML img src form and 'data' is a data frame or other non-plot result.

Examples

pdf <- encodePlot(grDevices::png, "image/png", 200, 300, function() {
  barplot(c(1, 2, 3, 4))
})
grDevices::png()  # workaround; you do not have to do this

[Package shinylight version 1.2 Index]