Skip to content
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

Discrete heatmapgl #4953

Merged
merged 3 commits into from
Jul 24, 2020
Merged

Discrete heatmapgl #4953

merged 3 commits into from
Jul 24, 2020

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jun 24, 2020

Initial PR to add zsmooth options to heatmapgl and resolve #4924.

@ordiology let's submit potential changes (as a separate PR) to this branch.

@plotly/plotly_js

…and discrete options

 - add image test for heatmapgl with false zsmooth i.e. discrete
@archmoj archmoj added this to the v1.55.0 milestone Jun 24, 2020
package.json Outdated Show resolved Hide resolved
@archmoj archmoj added the community community contribution label Jun 24, 2020
@archmoj
Copy link
Contributor Author

archmoj commented Jun 25, 2020

@ordiology nice work!
The only issue I noticed is that (when using low resolution input grid) the offsets at the corners are not identical and different from heatmap version.
Here is a codepen illstrating the problem.
When possible could you please fixing that on top of commits of this branch?

@ordiology
Copy link

ordiology commented Jun 25, 2020 via email

@alexcjohnson
Copy link
Collaborator

There is some subtlety about tooltip positioning: if you don't use zsmooth, each data point is drawn as a brick of constant color, and the tooltip should be drawn at the edge of the brick - normally the right edge, but when hovering on a point on the far right, when the tooltip moves to the left, its anchor jumps to the left edge of the brick. But with smoothing enabled the tooltip should be drawn at the exact data point. I haven't tested heatmapgl but heatmap does this correctly, so we should aim for heatmapgl to match this behavior.

@ordiology
Copy link

ordiology commented Jun 26, 2020 via email

@ordiology
Copy link

Sorry for the delay, @archmoj -- had something I had to work on last week for Friday deadline. The issue should be fixed... please let me know if it doesn't behave as expected.

@archmoj
Copy link
Contributor Author

archmoj commented Jul 6, 2020

Sorry for the delay, @archmoj -- had something I had to work on last week for Friday deadline. The issue should be fixed... please let me know if it doesn't behave as expected.

@ordiology no worries about this and thanks very much for the fix.
We still have few weeks to work on this feature before the next minor release.
The next step would be to open a PR from your fork to gl-vis.
gl-vis/gl-heatmap2d@master...ordiology:fix4924-discrete-heatmap2d
Thanks in advance.

@archmoj
Copy link
Contributor Author

archmoj commented Jul 6, 2020

Also here is the updated codepen including latest fix.
@ordiology could you please investigate why the hover is not showing up on the very first row & column?

@nicolaskruchten nicolaskruchten removed this from the v1.55.0 milestone Jul 7, 2020
@ordiology
Copy link

Thanks @archmoj, the hover is not showing up due to the bounds that are set up for the chart in the plotly.js convert.js trace for gl-heatmap2d. The discrete webgl heatmap requires an extra patch that the interpolated heatmap doesn't need. This patch amounts to half a patch before the first data location and half a patch after the last data location. In my implementation, I increased the ppad for both x and y in fullTrace._extremes to adjust for this.

I have also made a PR for my fork to gl-vis.

Thank you so much for your support with getting this feature into release.

package.json Outdated Show resolved Hide resolved
@archmoj
Copy link
Contributor Author

archmoj commented Jul 20, 2020

@ordiology I merged your gl-vis PR 🥇 i.e. gl-vis/gl-heatmap2d#6 and published a gl-heatmap2d minor.
Could you please investigate hover positioning issue mentioned in #4953 (comment)?

@ordiology
Copy link

That's great! Thanks @archmoj.

As I tried to explain in the comment just above... The size of the discrete heatmap is one patch larger than the smoothed heatmap. The bounds now extend half a patch beyond the minima and maxima of the x and y data ranges. I resolved this in my implementation by increasing the padding (ppad) of fullTrace._extremes in the plotly trace convert.js for gl-heatmap2d. Please let me know if this doesn't make sense.

@archmoj
Copy link
Contributor Author

archmoj commented Jul 24, 2020

@ordiology thanks for your work!
This option would be available in the next plotly.js minor.
💃

@archmoj archmoj merged commit edcb1a4 into master Jul 24, 2020
@archmoj archmoj deleted the fix4924-discrete-heatmap2d branch July 24, 2020 13:38
@ordiology
Copy link

Thank you so, so much, @archmoj!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrating discrete-heatmap2d
4 participants