Description Usage Arguments Value See Also Examples
Capture a plot as a self-contained <img>
tag
1 2 3 4 5 6 7 8 9 10 11 12 |
expr |
A plotting expression that generates a plot (or yields an object that generates a plot when printed, like a ggplot2). |
alt |
A single-element character vector that contains a text description of the image. This is used by accessibility tools, such as screen readers for vision impaired users. |
device |
A graphics device function; by default, this will be either
|
width, height |
The width/height that the generated tag should be displayed at, in logical (browser) pixels. |
pixelratio |
Indicates the ratio between physical and logical units of
length. For PNGs that may be displayed on high-DPI screens, use |
mimeType |
The MIME type associated with the |
deviceArgs |
A list of additional arguments that should be included when
the |
attribs |
A list of additional attributes that should be included on the
generated |
suppressSize |
By default, |
A browsable()
HTML <img>
tag object. Print it at
the console to preview, or call as.character()
on it to view the HTML
source.
capturePlot()
saves plots as an image file.
1 2 3 4 5 6 7 8 9 10 11 12 13 | img <- plotTag({
plot(cars)
}, "A plot of the 'cars' dataset", width = 375, height = 275)
if (interactive()) img
if (interactive() && capabilities("cairo")) {
plotTag(
plot(pressure), "A plot of the 'pressure' dataset",
device = grDevices::svg, width = 375, height = 275, pixelratio = 1/72,
mimeType = "image/svg+xml"
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.