Composing Layered & Multi-view PlotsEdit this page
A view that is composed of multiple views can itself be composed with other views. Through this hierarchical 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.
facet operator, you can partition the data and create a view for each subset to create a trellis plot. As a shortcut, Vega-Lite also has the
row encoding channels to quickly create a faceted view.
Learn how to use it on the facet page.
layer 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 is semantically 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 the layering page.
To place views side-by-side, Vega-Lite provides operators for horizontal (
hconcat) and vertical (
Learn how to use it on the concatenation page.
Often, you may concatenate similar views where the only difference is the field that is used in an encoding. The
repeat operator is a shortcut that creates a view for each entry in an array of fields.
repeat operator generates multiple plots like
facet. However, unlike
facet it allows full replication of a data set in each view.
Learn how to use it on the repeat 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 the resolve property.