Quickly creating heatmaps with pandas

Author

Thomas Camminady

Published

July 14, 2023

data = FileAttachment("seattle-weather.csv")
  .csv({typed: true})

Plot.plot({
  width: 800, height: 500, padding: 0,
  color: { scheme: "blues", type: "sqrt"},
  y: { tickFormat: i => "JFMAMJJASOND"[i] },
  marks: [
    Plot.cell(data, Plot.group({fill: "mean"}, {
      x: d => new Date(d.date).getDate(),
      y: d => new Date(d.date).getMonth(),
      fill: "precipitation",
      inset: 0.5
    }))
  ]
})