Evaluates a plotting expression in a temporary PNG device and returns
the resulting image as a self-contained, base64-encoded <img>
tag (class "html", see as.html()), suitable for
embedding directly in HTML text – a report, a question, an e-mail.
Arguments
- expr
a plotting expression, evaluated once inside the device. Character input is evaluated via
eval(parse(text = expr))for compatibility with the earlier form of this function.- width, height
size of the device in pixels
- res
nominal resolution in dpi, which also scales the text: raise it for a larger picture with the same relative proportions
- ...
further arguments passed to
grDevices::png()
Value
an object of class c("html", "character") containing an
<img> tag with a data:image/png;base64,... source
Details
The expression is passed unevaluated and carries its own environment, so a plot built inside a function sees that function's local variables. Several statements are given in braces, as in the examples below.
See also
Other html:
as.fileLink(),
as.html(),
embedFile(),
escapeHtml(),
htmlNotation,
htmlSubscript,
toHtmlTable()
