Lasagna Plot (Dense Time-Series Heatmap)

View this example in the online editor

Vega-Lite JSON Specification

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "transform": [{"filter": "datum.symbol !== 'GOOG'"}],
  "width": 300,
  "height": 100,
  "data": {
    "url": "data/stocks.csv"
  },
  "mark": "rect",
  "encoding": {
    "x": {
      "timeUnit": "yearmonthdate",
      "field": "date",
      "type": "ordinal",
      "title": "Time",
      "axis": {
        "format": "%Y",
        "labelAngle": 0,
        "labelOverlap": false,
        "labelColor": {
          "condition": {
            "test": {
              "timeUnit": "monthdate",
              "field": "value",
              "equal": {"month": 1, "date": 1}
            },
            "value": "black"
          },
          "value": null
        },
        "tickColor": {
          "condition": {
            "test": {
              "timeUnit": "monthdate",
              "field": "value",
              "equal": {"month": 1, "date": 1}
            },
            "value": "black"
          },
          "value": null
        }
      }
    },
    "color": {
      "aggregate": "sum",
      "field": "price",
      "type": "quantitative",
      "title": "Price"
    },
    "y": {
      "field": "symbol",
      "type": "nominal",
      "title": null
    }
  }
}