plot icon indicating copy to clipboard operation
plot copied to clipboard

Better support for dates in the raster mark

Open Fil opened this issue 4 months ago • 0 comments

The naive implementation does not work because it has banding issues due to quantization on the date axis.

In the example below we have monthly data. Even with the correct width (corresponding to the number of different months), some months are rounded down to the pixel on their left hand side. This happens because the rounding in InterpolateNone is made by flooring the date divided by the average length of a month. (And months expressed in milliseconds are not uniform.)

Image

An easy way to fix this would be to allow changing the interpolator to use Math.round instead of Math.floor:

Image

We could call this interpolator: "round". However we might want more control on x vs y, so maybe we need more options. It would also be nice to auto-apply rounding when the dimension is temporal?

Notebook exploration: https://observablehq.com/@observablehq/plot-raster-dates-2351

Fil avatar Nov 01 '25 18:11 Fil