-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heatmap mark? #1122
Comments
Related or duplicate of #984? Also not sure I follow why the recommended approach of rect + bin is “incomplete” with re. to projections, since we support projecting rects now (at least for cylindrical projections under the normal aspect). I used rect for this recently for Advent of Code: Plot.plot({
grid: true,
round: true,
x: {domain: [grid.x1 - 0.5, grid.x2 + 0.5]},
y: {domain: [grid.y2 + 0.5, -0.5]},
color: {
domain: ["rock", "sand", "source"],
range: ["#5a4d41", "#c2b280", "red"]
},
marks: [
Plot.rect(grid.values, {
x1: (d, i) => grid.x1 + i % grid.m - 0.5,
y1: (d, i) => grid.y1 + Math.floor(i / grid.m) - 0.5,
x2: (d, i) => grid.x1 + i % grid.m + 0.5,
y2: (d, i) => grid.y1 + Math.floor(i / grid.m) + 0.5,
fill: (d) => d
})
]
}) I originally used the interval option (1) but for the smaller grids I wanted the rects to be centered on their value rather than between values. |
I would like to better understand how continuous heatmaps are commonly expressed. Do we want a sparse sample-based approach as with the pixel mark in #1185 (which is really just an optimization of the existing rect mark + interval transform)? Or does the user want to supply a continuous function of xy that is them sampled automatically (in a grid) by Plot? Or maybe the user supplies dense samples in a grid (similar to ImageData) so that the x and y channels can be implicit? Or all of the above? |
matplotlib has a funky interpolation method |
Fixed in #1196. |
I sometimes see users trying to make heatmaps with Plot.cell, which results in incorrect charts when x and y are continuous. The recommended approach (until now) was to use Plot.bin to create the small squares (or rather, rectangles), as x/y bins. However with projections, this is now incomplete, and we should have a solution for heatmaps in the projected space. Like hexbin, but based on squares (or any other tessellation?). There's probably a lot of code to share with hexbin, the most difficult part to decide might be the API?
The text was updated successfully, but these errors were encountered: