defer
Build a deferred panel forcompose.
defer partial-applies a renderer (plot or@compose) so the result is a thunk rather than rendered content. compose invokes the thunk itself, supplying the cell dimensions and the internal as-spec switch, then probes each panel’s guides and re-renders with the hoisted aesthetics suppressed. Omit width/height: the composition sizes every cell. Use defer(compose, ...) to nest one composition inside another.
Usage
defer(
renderer,
..args,
)Parameters
| Parameter | Default | Description |
|---|---|---|
renderer |
The renderer to defer: theplot orcompose function. |
|
..args |
Arguments forwarded to renderer, e.g. data, mapping, and layers forplot, or the panel thunks and layout options for a nestedcompose. |
Returns
A deferred-panel thunk to pass as a positional argument tocompose.
Examples
Two deferred scatter panels sharing a hoisted colour legend.
#let panel(map) = defer(plot,
data: mpg, mapping: map,
layers: (geom-point(size: 3pt),),
)
#compose(
panel(aes(x: "displ", y: "hwy", colour: as-factor("cyl"))),
panel(aes(x: "displ", y: "cty", colour: as-factor("cyl"))),
columns: 2,
)