With Vega-Lite, you can not only create single view visualizations, but alsofacet,layer,concatenate, andrepeat these views into layered or multiview displays.
A layered or multi-view display can also be composed with other views. Through thishierarchical composition, you can create a whole dashboard as a single specification.
Vega-Lite’s compiler infers how input data should be reused across constituent views, and whether scale domains should be unioned or remain independent.
With thefacet
operator, you can partition the data and create a view for each subset to create atrellis plot. As a shortcut, Vega-Lite also has thecolumn
androw
encoding channels to quickly create a faceted view.
Learn how to use it on thefacet page.
With thelayer
operator, you can place multiple views on top of each other. This can be useful to add annotations to views. Vega-Lite automatically unions scale domains and combines axes and legends.
However, Vega-Lite can not enforce that a unioned domain issemantically meaningful. To prohibit layering of composite views with incompatible layouts, the layer operator restricts its operands to be single or layered views.
Learn how to use it on thelayering page.
To place views side-by-side, Vega-Lite provides operators for horizontal (hconcat
) and vertical (vconcat
) concatenation.
Learn how to use it on theconcatenation page.
Often, you may concatenate similar views where the only difference is the field that is used in an encoding. Therepeat
operator is a shortcut that creates a view for each entry in an array of fields.
Therepeat
operator generates multiple plots likefacet
. However, unlikefacet
it allows full replication of a data set in each view.
Learn how to use it on therepeat page.
Vega-Lite determines whether scale domains should be unioned. If the scale domain is unioned, axes and legends can be merged. Otherwise they have to be independent.
To override scale, axis, and legend resolution, you can set theresolve property.