# NOT RUN {
# Default settings
res <- capturePlot(plot(cars))
if (interactive()) browseURL(res)
# Use custom width/height
pngpath <- tempfile(fileext = ".png")
capturePlot(plot(pressure), pngpath, width = 800, height = 375)
if (interactive()) browseURL(pngpath)
# Use SVG
svgpath <- capturePlot(
plot(pressure),
tempfile(fileext = ".svg"),
grDevices::svg,
width = 8, height = 3.75)
if (interactive()) browseURL(svgpath)
# Clean up
unlink(res)
unlink(pngpath)
unlink(svgpath)
# }
Run the code above in your browser using DataLab