-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Add support for extra hovertool variables in a Bokeh QuadMesh with 2-D coordinates (with tests) #5638
Conversation
These unit tests check that any extra vdims provided when instantiating a `QuadMesh` with 2-D coordinate arrays are correctly passed to the Bokeh `ColumnDataSource` for use in hover labels. This test fails in HoloViews 1.15.4, which supports extra vdims when using 1-D coordinates but not 2-D coordinates.
This unit tests checks that any extra vdims provided when instantiating a `QuadMesh` with 1-D coordinate arrays are correctly passed to the Bokeh `ColumnDataSource` for use in hover labels. This feature is fully supported and functioning properly in HoloViews 1.15.4 (so the test should pass), unlike for 2-D coordinates wherein any extra vdims are lost.
…t_data` to a new staticmethod `QuadMeshPlot._collect_hover_data`. This change was made in preparation for implementing the equivalent functionality in "irregular" meshes with 2-D coordinate arrays, which will enable the inclusion of additional variables in the hovertool for non-rectilinear geometries. All tests still pass (except for the newly added tests for the feature being implemented).
…QuadMesh` plots from 2-D coordinate arrays. This change allows for the inclusion of additional variables in the hovertool for non-rectilinear geometries, which has long been supported for simple geometries defined by 1-D coordinate arrays. This fix only required very minor changes to the `QuadMeshPlot.get_data` method, and no other functionality should be affected. All tests now pass, including the 2 new ones added to test this functionality, as well as the 3rd new test added to ensure that the existing behavior for 1-D coordinates was not affected.
…ticmethod to explain why the need for transposing the arrays before flattening is reversed when creating a `QuadMesh` from 2-D coordinate arrays.
Codecov Report
@@ Coverage Diff @@
## main #5638 +/- ##
==========================================
- Coverage 88.25% 84.35% -3.90%
==========================================
Files 302 302
Lines 62532 62557 +25
==========================================
- Hits 55189 52773 -2416
- Misses 7343 9784 +2441
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
It looks like the 3 failed checks are just a few tests getting skipped due to |
The failing tests on Python 3.7 are unrelated to your changes. So don't worry about those 🙂 I will take an in-depth look at this PR tomorrow. |
Glad to hear, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What an amazing first PR! 🥇
I have one small question.
…ollect_hover_data` method. This involved converting the staticmethod to an instance method, changing the `transpose` argument to `irregular`, and then adding a line to derive `transpose` from `invert_axes` and `irregular`. This change was made to increase clarity by putting the unintuitive step closer to where it is used, and right next to the docstring explaining it.
…h-quadmesh-extra-vdims
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When creating a Bokeh
QuadMesh
in the current version of HoloViews, you can supply additional data variables that will appear in the hovertool; however, this is only works for rectilinear geometries where the given coordinate arrays are 1-dimensional. When 2-dimensional coordinate arrays are given, any extra data variables are silently discarded and their values are displayed as "???" in the generated hovertool.This pull request implements a simple fix that extends this functionality to support both 1-D and 2-D coordinates, which will allows
QuadMesh
plots to be created for non-rectilinear geometries without giving up the ability to add additional variables to the hovertool.Three new unit tests were also added to verify this change; one for testing that the existing functionality for 1-D coordinates is not affected, and the other two for testing the new functionality for 2-D coordinates.
See the screenshot below for a comparison of the hovertool behavior in a Jupyter notebook before and after implementing the fix: