Compiles a PlotSpec into a vellum::vl_scene() and writes it. The output
format is taken from the file extension (.png, .svg, .pdf).
vellum::render() also works on a plot directly, dispatching through the
as_vellum_scene() seam.
Arguments
- plot
A PlotSpec.
- path
Output file path.
- text
For SVG output, how text is written (see
vellum::render()).- dpi
Output resolution in dots per inch.
NULL(default) uses the plot's authored resolution (set onvplot()); a number overrides it for this render, so the PNG's pixel dimensions becomewidth * dpibyheight * dpi. Ignored for.svg/.pdf, which are resolution-independent.
Examples
p <- vplot(mtcars) |> mark_point(x = wt, y = mpg)
f <- tempfile(fileext = ".png")
render_plot(p, f)
render_plot(p, f, dpi = 300) # denser raster, same physical size
