Concatenating views
Edit this pageTo place views side-by-side, Vega-Lite’s view composition provides the following concatenation operators:
hconcat
- horizontal concatenationvconcat
- vertical concatenationconcat
- general concatenation (wrappable)
If you concatenate similar views where the only difference is the field that is used in an encoding, use the repeat
operator.
Documentation Overview
- Documentation Overview
- Horizontal Concatenation
- Vertical Concatenation
- General (Wrappable) Concatenation
- Resolve
- Concat Configuration
Horizontal Concatenation
To put multiple views into a column, set the "hconcat"
to an array of view specifications.
{
"hconcat": [
... // Specifications
],
...
}
In addition to common properties of a view specification, a horizontal concat specification has the following properties:
Property | Type | Description |
---|---|---|
hconcat | Spec[] |
Required. A list of views to be concatenated and put into a row. |
Example
Vertical Concatenation
To put multiple views into a row, set the "vconcat"
to an array of view specifications.
{
"vconcat": [
... // Specifications
],
...
}
In addition to common properties of a view specification, a vertical concat specification has the following properties:
Property | Type | Description |
---|---|---|
vconcat | Spec[] |
Required. A list of views to be concatenated and put into a column. |
Example
General (Wrappable) Concatenation
To put multiple views into a flexible flow layout, set the "concat"
to an array of view specifications and specify the "columns"
property to set the number of maximum items per rows.
{
"concat": [
... // Specifications
],
"columns": ...,
...
}
In addition to common properties of a view specification, a general concat specification has the following properties:
Property | Type | Description |
---|---|---|
concat | Spec[] |
Required. A list of views to be concatenated. |
columns | Number |
The number of columns to include in the view composition layout. Default value: Note: 1) This property is only for:
2) Setting the |
Example
Resolve
The default resolutions for concatenation 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 concatenated views.
Concat Configuration
// Top-level View Specification
{
...,
"config": { // Configuration Object
"concat": { // - Concat Configuration
"spacing": ...,
"columns": ...,
},
...
}
}
The concat configuration supports the following properties:
Property | Type | Description |
---|---|---|
columns | Number |
The number of columns to include in the view composition layout. Default value: Note: 1) This property is only for:
2) Setting the |
spacing | Number |
The default spacing in pixels between composed sub-views. Default value: |