Skip to content

Let digits toggle axes nav only if they correspond to an existing axes. #12141

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

Merged
merged 1 commit into from
Feb 10, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 17, 2018

Currently, pressing a (1-9) digit key while the cursor is on an axes
will change whether axes, in general, are responsive to "navigation" UI
(pan/zoom/interactive cursor): if the cursor is over axes m and digit
n is pressed, then axes m will become unresponsive to navigation UI
if m!=n, and become responsive again if m==n.

That's likely not the originally desired behavior: in the patch below, I
think the check a.in_axes(event) (which has a FIXME comment...) should
be removed...

While this is getting sorted out, in the meantime, this patch changes
the behavior above to not disable axes m if m!=n and n is greater
than the total number of axes (i.e., in a case where n does not
correspond to any valid axes). The use case here is to use "4" and "6"
as navigation keys for an interactive image stack viewer (unfortunately
one can't by default use either left/right or h/l as Matplotlib already
assigns default meanings for these keys).

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Currently, pressing a (1-9) digit key while the cursor is on an axes
will change whether axes, in general, are responsive to "navigation" UI
(pan/zoom/interactive cursor): if the cursor is over axes *m* and digit
*n* is pressed, then axes *m* will become unresponsive to navigation UI
if m!=n, and become responsive again if m==n.

That's likely not the originally desired behavior: in the patch below, I
think the check `a.in_axes(event)` (which has a FIXME comment...) should
be removed...

While this is getting sorted out, in the meantime, this patch changes
the behavior above to *not* disable axes *m* if m!=n and *n* is greater
than the total number of axes (i.e., in a case where *n* does not
correspond to any valid axes).  The use case here is to use "4" and "6"
as navigation keys for an interactive image stack viewer (unfortunately
one can't by default use either left/right or h/l as Matplotlib already
assigns default meanings for these keys).
@anntzer anntzer added this to the v3.1 milestone Sep 17, 2018
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me...

@timhoffm timhoffm merged commit 51e77e1 into matplotlib:master Feb 10, 2019
@anntzer anntzer deleted the axesnav branch February 10, 2019 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants