Connected Scatterplot (Lines with Custom Paths)
A connected scatterplot can be created by customizing line order
and adding point
overlay in the line mark definition.
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {"url": "data/driving.json"},
"mark": {"type": "line", "point": true},
"encoding": {
"x": {
"field": "miles", "type": "quantitative",
"scale": {"zero": false}
},
"y": {
"field": "gas", "type": "quantitative",
"scale": {"zero": false}
},
"order": {"field": "year"}
}
}