Slope Graph

Slope graph showing the change in yield for different barley sites. It shows the error in the year labels for the Morris site.

View this example in the online editor

Vega-Lite JSON Specification

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {"url": "data/barley.json"},
  "description": "Slope graph showing the change in yield for different barley sites. It shows the error in the year labels for the Morris site.",
  "mark": "line",
  "width": {"step": 50},
  "encoding": {
    "x": {
      "field": "year",
      "type": "ordinal",
      "scale": {"padding": 0.5}
    },
    "y": {
      "aggregate": "median",
      "field": "yield",
      "type": "quantitative"
    },
    "color": {"field": "site", "type": "nominal"}
  }
}