Skip to contents

Building & rendering scenes

Build a scene functionally with vl_scene() and a pipeline of push() / draw() / pop(), then render it. render() picks the backend (PNG / SVG / PDF) from the file extension.

vl_scene() push() draw() pop() render()
Build and render a scene
describe()
Set a scene's accessibility name and description
display()
Display a scene in the active graphics device
scene_raster()
Read a rendered scene back as pixels
scene_svg()
Render a scene to an SVG string
scene_png() scene_pdf()
Render a scene to PNG or PDF bytes
as_vellum_scene()
Coerce an object to a vellum scene
vl_render_animation()
Render a keyframe animation

Graphical objects (grobs)

The drawable primitives. Most are vectorised and batch internally.

Units, viewports & layout

Coordinate systems, nested viewports with scales, clipping and rotation, and the row/column layout solver.

vl_unit() is_unit()
Units of measurement
vl_convert()
Convert a unit to another unit, in a scene's context
vl_viewport() grid_layout()
Viewports and layouts
grobwidth() grobheight()
Size a unit by a grob's extent
why_size()
Explain why a node has its resolved size

Inspecting a scene

Static analysis, coverage statistics, and render profiling — all reading the resolved geometry the renderer draws with.

vl_lint()
Check a scene for likely mistakes
vl_lint_assert()
Fail on lint findings
vl_lint_overlay()
Draw lint findings onto the scene
vl_lint_rule() vl_lint_rules()
Register a lint rule
vl_lint_finding()
Build a lint finding
scene_stats()
Ink and overplotting statistics for a scene
profile_render()
Where a scene spends its render time
as_scene_spec() from_scene_spec()
Convert a scene to and from a plain list
scene_write() scene_read()
Write and read a scene
scene_hash()
A content fingerprint for a scene
scene_diff()
What changed between two scenes
scene_inset()
Inset one scene inside another

Paint & appearance

The paint model shared across all backends: gradients, tiling patterns, masks, reusable styles, and hand-drawn rendering.

vl_gpar()
Graphical parameters
style()
Reusable style classes
linear_gradient() radial_gradient()
Gradient fills
vl_pattern()
Tiling-pattern fills
vl_hatch()
Hatch fill
as_mask()
Masks
vl_shadow()
Drop shadow for a viewport group
sketch()
Hand-drawn ("sketch") rendering

Text

Device-independent shaping and measurement, Markdown-style rich labels, and layout: text wrapped to a box or set along a curve.

vl_strwidth() vl_strheight()
Measure text
md()
Rich-text labels (markdown subset)
text_path_grob()
Text set along a path

Placement

Geometry services over a scene’s resolved boxes: move labels apart, find the emptiest region, outline and buffer a group.

vl_place() vl_repel()
Move labels so they stop overlapping
vl_empty_region()
Find the largest empty rectangle in a scene
vl_hull()
Hull of a point set
vl_buffer()
Buffer a polygon outward

Geometry operations

Producing paths: boolean combinations, contours from a grid, and SVG path data imported as real vector geometry.

vl_path_op()
Boolean operations on paths
vl_contour() contour_grob()
Contour lines from a grid
vl_svg_path() svg_grob()
SVG path data as scene geometry

Output reach

Destinations for a finished scene beyond a single file: a multi-page document, and a batch rendered across cores.

pdf_pages()
Write several scenes as the pages of one PDF
render_all()
Render many scenes in parallel

Accessibility & fonts

Tagged PDF output from the per-mark metadata channel, and a check on the one part of the determinism claim vellum does not control.

scene_fonts()
Which fonts a scene actually used
font_pin() font_check()
Pin a scene's fonts, and check them later

Big data

Aggregate-then-shade rendering for large point clouds, dense timeseries, and network edges.

datashade()
Aggregate-then-shade a large point cloud (datashader-style)
datashade_lines() datashade_segments()
Aggregate-then-shade dense lines and segments (datashader-style)
spread()
Spread (dilate) the pixels of a raster grob
dynspread()
Dynamically spread a raster grob to a target density

Querying & editing scenes

A solved scene reports its geometry: a per-element model with data keys and device-pixel boxes, picking by point, and editing by node name.

node_names() get_node() edit_node()
Inspect and edit a scene by node name
hit_test()
Hit-test a scene
scene_model()
A serializable, per-element model of a scene
vl_nearest()
Find the marks nearest a point, by true geometry
element_geometry()
The true geometry of a scene's addressable elements

Grid & ggplot2 interop

Render an existing grid grob tree — including ggplot2 and lattice — through the vellum backend.

as_vellum() render_grid()
Render grid graphics (ggplot2 / lattice / grid) through vellum

Caches & diagnostics

vl_clear_render_cache()
Clear the render cache

Package

vellum vellum-package
vellum: Low-Level Graphics with Device-Independent Layout and Queryable Scenes