Composing Layered & Multi-view Plots

Edit this page

With Vega-Lite, you can not only create single view visualizations, but also facet, layer, concatenate, and repeat these views into layered or multiview displays.

A layered or multi-view display can also 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.

Documentation Overview

Faceting

With the 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 column and row encoding channels to quickly create a faceted view.

Learn how to use it on the facet page.

Layering

With the 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.

Concatenation

To place views side-by-side, Vega-Lite provides operators for horizontal (hconcat) and vertical (vconcat) concatenation.

Learn how to use it on the concatenation page.

Repeating

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.

The 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.

Resolution

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.