A layer combines multiple marks or charts in one visualization. It is useful when a single chart needs an additional visual element for comparison, emphasis, or context. section 3.1.2
Overlaying a line and points
A Vega-Lite layer can place a line chart and circular points over the same data. In Altair, the same idea appears by adding charts with the + operator. This lets the line show the overall pattern while the points make individual observations visible. section 3.1.2 section 4.5.2
Listing 3.11 An example layer section
"layer": [
{"mark": {"type": "line", }},
{"mark": {"type": "point", "shape": "circle", "size": 100}}
]
Inspect the compact Vega-Lite layer specification combining a line mark with a circular point mark. section 3.1.2
Layers also add context to an existing chart. A bar chart can be combined with images and a horizontal rule at 50%, making performance above or below a baseline easier to interpret. section 4.5.2
