This website is for Vega-Lite v2. Go to the main Vega-Lite homepage for the latest release.

Repeat a View

Edit this page

The repeat operator is part of Vega-Lite’s view composition. It provides a shortcut that creates a view for each entry in an array of fields. This operator generates multiple plots like facet. However, unlike facet it allows full replication of a data set in each view.

Documentation Overview

Repeat Operator

To repeat a view, define what fields should be used for each entry in the row or columns. Then define the repeated view in spec with a reference to a repeated field ({"repeat": ...}).

  "repeat": {
    ... // Repeat definition
  "spec": ... // Specification

For instance, you can use this operator to quickly create an overview over the trends in multiple variables.

Note how the field for the y channel refers to a repeated field.

"y": {
  "field": {"repeat": "column"}

In addition to common properties of a view specification, a repeat specification has the following properties:

Property Type Description
repeat Repeat

Required. An object that describes what fields should be repeated into views that are laid out as a row or column.

spec Spec
align VgLayoutAlign | RowCol

The alignment to apply to grid rows and columns. The supported string values are "all", "each", and "none".

  • For "none", a flow layout will be used, in which adjacent subviews are simply placed one after the other.
  • For "each", subviews will be aligned into a clean grid structure, but each row or column may be of variable size.
  • For "all", subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.

Alternatively, an object value of the form {"row": string, "column": string} can be used to supply different alignments for rows and columns.

Default value: "all".

bounds String

The bounds calculation method to use for determining the extent of a sub-plot. One of full (the default) or flush.

  • If set to full, the entire calculated bounds (including axes, title, and legend) will be used.
  • If set to flush, only the specified width and height values for the sub-view will be used. The flush setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.

Default value: "full"

center Boolean | RowCol

Boolean flag indicating if subviews should be centered relative to their respective rows or columns.

An object value of the form {"row": boolean, "column": boolean} can be used to supply different centering values for rows and columns.

Default value: false

spacing Number | RowCol

The spacing in pixels between sub-views of the composition operator. An object of the form {"row": number, "column": number} can be used to set different spacing values for rows and columns.

Default value: 10

resolve Resolve

Scale and legend resolutions for repeated charts.

The repeat property is an object with two optional properties. They define the list of fields that should be repeated into a row or column.

Property Type Description
column String[]

Horizontal repeated views.

row String[]

Vertical repeated views.

Example: Repeated Histogram

Example: Scatterplot Matrix (SPLOM)

Repeat can be used to create a scatterplot matrix (SPLOM), where each cell shows a different 2D projection of the same data table. Here, we define both row and column.

You can also check the interactive SPLOM example.


The default resolutions for repeat are independent scales and axes for position channels and shared scales and legends for all other channels. Currently, Vega-Lite does not support shared axes for repeated views.