Skip to content

Better support for dates in the raster mark #2351

@Fil

Description

@Fil

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions