orb_svg: Render a plot as SVG

View source: R/render_svg.R

orb_svgR Documentation

Render a plot as SVG

Description

Produces a standalone SVG image of a plot. SVG is a vector format, so the result is resolution independent: it stays sharp at any size or zoom level, which is what makes it suitable both for the web and for print.

Usage

orb_svg(plot, width = 820, height = 520, interactive = TRUE, id = NULL)

Arguments

plot

An orb_spec object.

width, height

Size in pixels.

interactive

Embed JavaScript for tooltips, hover highlighting, zoom, pan and legend toggling. Set FALSE for a static image, for example when embedding in a document that forbids scripts.

id

Element id used by the embedded script; generated if NULL.

Value

A character string containing SVG (and, if requested, a wrapping div with the script).

See Also

orb_save(), orb_interactive()

Examples

p <- orb(mtcars, x = wt, y = mpg) + orb_points()
s <- orb_svg(p, interactive = FALSE)
substr(s, 1, 40)

orbis documentation built on Aug. 5, 2026, 9:08 a.m.