| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I note that the existing x-/y- modifiers do not really work when using my laptop's touchpad1, but this proposal does work nicely 👍 Footnotes
|
Sorry, something went wrong.
Sorry, something went wrong.
|
Matlab has similar behavior. Could implement something similar where the lines at the edge indicate the region the mouse needs to be in? Screen.Recording.2025-09-14.at.19.18.48.mov |
Sorry, something went wrong.
|
The range marker is a good visualization to indicate the difference. Though, I would like to additionally keep dashed lines as an extension of the whiskers, because that helps to ensure relevant data points are included. That said, all the visual changes would need refactoring and backend-dependent implementation as currently all visualization is done via RubberBandBase and that does only cover the rectangle without the ability for further modification. matplotlib/lib/matplotlib/backend_tools.py Line 327 in 5b38f50 |
Sorry, something went wrong.
|
Backends so far
|
Sorry, something went wrong.
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
…plotlib into feature/single-axis-zoom
|
All backends have been updated. As previously mentioned, I was unable to test gtk on my machine, but I have tested all other backends. Several other fixes were also included:
|
Sorry, something went wrong.
Could you move them out into a separate PR? It makes reviewing this PR simpler if we don't have multiple topics. This PR is a good prove-of-concept and from a first glance feature complete - thanks for implementing all the backends! We still need to think about the architecture and how to bring it into the main library. As is, the draw_whisker method is an API change that will break third-party backends. We'll have to decide
|
Sorry, something went wrong.
|
The bugfixes have been separated into #30560 Regarding third-party backends, I don't fully understand how these would break. The empty draw_whiskers method in the base class NavigationToolbar2 appears to address this concern. During development, even before integrating the whiskers into a new backend, the backend would continue to function, albeit without displaying the whiskers. lib/matplotlib/backend_bases.py:2938 Attempting to use the ipympl backend in Jupyter leads to the following behaviour:
|
Sorry, something went wrong.
|
Tested with mplcairo third party backend and got the following results
|
Sorry, something went wrong.
|
Having a more thorough read of the issues you've linked, I think we can consider the following implementation: A draw_line() method be implemented for each backend, taking in color/stroke/dash parameters. draw_rubberband() and draw_whiskers() could then make use of this method in a backend-agnostic way. I see that this could have some ramifications on third party backends, as it could break draw_rubberband() as they won't have a draw_line() method (unless subclassed from a mpl backend). Somewhat uncertain about the versioning system, is this for third party backends only? or is there concern that mpl native backends could misalign with the package itself? |
Sorry, something went wrong.
native backends could partially misalign, i.e. an intenal backend doesn't have to be on the newest version of the API, but of course it must have a version that is supported, i.e. if at some point matplotlib supports backend versions v1 and v2, then every internal backend must be one of these versions. For example it would be permissible if we don't implement a new API for all backends right away. |
Sorry, something went wrong.
For the time being, I would leave draw_rubberband() it's working as is. We can refactor that later when/if backends have gained more general drawing capability. |
Sorry, something went wrong.
…-zoom # Conflicts: # lib/matplotlib/backends/web_backend/js/mpl.js # src/_macosx.m
|
After an almost year-long nap, I’ve revived this PR 😅 I updated the branch to current main and addressed the backend compatibility concerns from the earlier discussion:
The unrelated rubberband fixes were split into #30560, which has since merged. I tested the updated implementation across macOS, wx, Tk, Qt, GTK3, and WebAgg in light and dark mode (see screenshots)
Should backends without whisker support still get inferred single-axis zoom? They currently do because the gesture logic lives in NavigationToolbar2. If the visual indicator should be required, I can add an explicit supports_single_axis_zoom = False capability and enable it only in backends that implement whiskers. That would preserve the existing rectangle-zoom behavior for older backends. Since #30953 now covers a broader overlay architecture, are you comfortable merging these optional backend hooks as an incremental step, with a later migration to the overlay system? I’m happy to adjust the direction before doing more cleanup. |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR summary
Tangent to #30541
Screen.Recording.2025-09-14.at.01.37.29.movAllows for zooming in a single axis using the zoom rectangle by dragging only in one direction.
PR checklist