VegaLite.repeat
You're seeing just the function
repeat
, go back to VegaLite module for more information.
Specs
Builds a repeated multi-view specification from the given single-view template.
Repeat definition must be either a list of fields
or a row/column/layer mapping.
Then some channels can be bound to a repeated field using encode_repeat/4
.
Examples
# Simple repeat
Vl.new()
|> Vl.data_from_values(...)
|> Vl.repeat(
["temp_max", "precipitation", "wind"],
Vl.new()
|> Vl.mark(:line)
|> Vl.encode_field(:x, "date", time_unit: :month)
# The graphic will be reapeated with :y mapped to "temp_max",
# "precipitation" and "wind" respectively
|> Vl.encode_repeat(:y, :repeat, aggregate: :mean)
)
# Grid repeat
Vl.new()
|> Vl.data_from_values(...)
|> Vl.repeat(
[
row: [
"beak_length",
"beak_depth",
"flipper_length",
"body_mass"
],
column: [
"body_mass",
"flipper_length",
"beak_depth",
"beak_length"
]
],
Vl.new()
|> Vl.mark(:point)
# The graphic will be repeated for every combination of :x and :y
# taken from the :row and :column lists above
|> Vl.encode_repeat(:x, :column, type: :quantitative)
|> Vl.encode_repeat(:y, :row, type: :quantitative)
)
See the docs for more details.