powered by
Renders a plot as a base64-encoded image
encodePlot(device, mimeType, width, height, plotFn)
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.
'plot'
'data'
Graphics device function, such as grDevices::png or grDevices::pdf
grDevices::png
grDevices::pdf
Mime type for the data produced by device
device
Width of the plot in units applicable to device
Height of the plot in units applicable to device
Function to call to perform the plot
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
Run the code above in your browser using DataLab