You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was developing a simple GUI and ran into unexpected behaviour when pressing the number keys 1-9, which disable/enable panning.
Based on the online documentation I was using (http://matplotlib.org/users/navigation_toolbar.html), I wasn't expecting any of the number keys to be used as keyboard shortcuts. However, the key_press_handler method defined in backend_bases.py uses the number keys 1-9 to enable/disable panning on axes (I attached excerpt code below).
I think it would be nice to have these features documented on the webpage, so other developers know that the number keys are used by matplotlib.
Also, here are two thoughts:
Is the ability to toggle navigation actually needed? (I am not sure what the use-case would be.)
Assuming the ability to toggle navigation is indeed needed, wouldn't a single button that toggles navigation on given subplot (the one under the cursor) be better? It would (A) free up keyboard shortcuts for other uses and (B) would work when more than 10 subplots are present.
elif (event.key.isdigit() andevent.key!='0') orevent.keyinall:
# keys in list 'all' enables all axes (default key 'a'),# otherwise if key is a number only enable this particular axes# if it was the axes, where the event was raisedifnot (event.keyinall):
n=int(event.key) -1fori, ainenumerate(canvas.figure.get_axes()):
# consider axes, in which the event was raised# FIXME: Why only this axes?ifevent.xisnotNoneandevent.yisnotNone \
anda.in_axes(event):
ifevent.keyinall:
a.set_navigate(True)
else:
a.set_navigate(i==n)
The text was updated successfully, but these errors were encountered:
This was handled in MEP22.
These keys 1-9 are captured by the tool ToolEnableNavigation that can be disabled by calling fig.canvas.manager.toolmanager.remove_tool('nav')
I'm closing the issue because there is a working solution now. Please reopen if necessary
I was developing a simple GUI and ran into unexpected behaviour when pressing the number keys 1-9, which disable/enable panning.
Based on the online documentation I was using (http://matplotlib.org/users/navigation_toolbar.html), I wasn't expecting any of the number keys to be used as keyboard shortcuts. However, the key_press_handler method defined in backend_bases.py uses the number keys 1-9 to enable/disable panning on axes (I attached excerpt code below).
I think it would be nice to have these features documented on the webpage, so other developers know that the number keys are used by matplotlib.
Also, here are two thoughts:
Here's the code from key_press_handler (here's a link https://github.com/matplotlib/matplotlib/blob/v1.3.x/lib/matplotlib/backend_bases.py#L2523)
The text was updated successfully, but these errors were encountered: