Skip to contents

Replicate a plot, re-pointing one or more encodings at a different data field each time, and arrange the copies as a composition (like concat(), so each sub-plot keeps its own scales and axes). Supply each aesthetic as a character vector of column names; all vectors must be the same length N, and are zipped to produce N sub-plots.

Usage

repeat_(plot, ..., ncol = NULL, nrow = NULL)

Arguments

plot

A PlotSpec; the repeated aesthetic(s) are set on every layer (added if not already mapped). In a multi-layer plot every layer therefore receives the re-pointed field, so any layer carrying its own data must contain the named field columns.

...

Named aesthetics, each a character vector of field names, e.g. x = c("wt", "hp", "disp").

ncol, nrow

Grid dimensions (passed to concat()).

Value

A PlotComposition.

Examples

repeat_(vplot(mtcars) |> mark_point(y = mpg), x = c("wt", "hp", "disp"))