Compiles x and returns its provenance table: one record per emitted mark
grob, tying each low-level primitive back to the data rows and trained scales
that produced it. Each record's id matches the grob's data-vellum-id in
the SVG output (and the id column of vellum::scene_model()), so it is a
stable join key between the rendered scene and the grammar — the substrate for
interactivity, linked views, and accessibility.
Arguments
- x
A PlotSpec or plot composition.
Details
Each record is a plain, serializable list:
idstable node id, equal to
grob@id/ SVGdata-vellum-id(join key).layer1-based layer index within the (sub-)plot spec.
markmark type (
"point","line", …).kind"mark"(the core layer) or"effect"(a decorative underlay).panelfacet panel key (
"panel-r-c"), orNAfor a single panel.channelsaesthetic → trained-scale reference (
scale,type,domain).rowsthe original input-data row indices this grob draws.
The rows field is refined per element for marks that map rows one-to-one to
drawn elements (points, bars, tiles, segments, lines, areas, ribbons, steps,
text, boxplots, sf features, edges); for aggregating marks (histogram,
density, smooth, datashade, …) it is the whole layer, since rows no longer map
to single elements.
See also
vellum::scene_model() and the scene-contract vignette in vellum.
Examples
df <- data.frame(wt = mtcars$wt, mpg = mtcars$mpg, model = rownames(mtcars))
p <- vplot(df) |> mark_point(x = wt, y = mpg, data_id = model)
prov <- plot_provenance(p)
prov[[1]]$id
#> [1] "layer-1-point-g1"
