Plot.plot({
color: { legend: true },
y: { domain: [0, h] },
marks: [
Plot.raster(
{ length: w * h },
{
width: w,
height: h,
x: (_, i) => (i % w) + 0.5,
y: (_, i) => Math.floor(i / w) + 0.5,
fill: (_, i) => data[i],
imageRendering: "pixelated",
interpolate: "none",
tip: true
}
)
],
x: { domain: [0, w].map(transform), transform }
})