encodePlot | R Documentation |
Renders a plot as a base64-encoded image
encodePlot(device, mimeType, width, height, plotFn)
device |
Graphics device function, such as
|
mimeType |
Mime type for the data produced by |
width |
Width of the plot in units applicable to |
height |
Height of the plot in units applicable to |
plotFn |
Function to call to perform the plot |
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.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.