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

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/v3.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", "type": "temporal"}
  }
}