Title: key_press_handler captures number keys and 'a'? · Issue #2699 · matplotlib/matplotlib · GitHub
Open Graph Title: key_press_handler captures number keys and 'a'? · Issue #2699 · matplotlib/matplotlib
X Title: key_press_handler captures number keys and 'a'? · Issue #2699 · matplotlib/matplotlib
Description: 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'...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/2699
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"key_press_handler captures number keys and 'a'?","articleBody":"I was developing a simple GUI and ran into unexpected behaviour when pressing the number keys 1-9, which disable/enable panning. \n\nBased 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).\n\nI 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.\n\nAlso, here are two thoughts:\n1. Is the ability to toggle navigation actually needed? (I am not sure what the use-case would be.)\n2. 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.\n\nHere'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)\n\n``` python\n\n elif (event.key.isdigit() and event.key != '0') or event.key in all:\n # keys in list 'all' enables all axes (default key 'a'),\n # otherwise if key is a number only enable this particular axes\n # if it was the axes, where the event was raised\n if not (event.key in all):\n n = int(event.key) - 1\n for i, a in enumerate(canvas.figure.get_axes()):\n # consider axes, in which the event was raised\n # FIXME: Why only this axes?\n if event.x is not None and event.y is not None \\\n and a.in_axes(event):\n if event.key in all:\n a.set_navigate(True)\n else:\n a.set_navigate(i == n)\n```\n","author":{"url":"https://github.com/eyurtsev","@type":"Person","name":"eyurtsev"},"datePublished":"2013-12-30T01:58:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2699/matplotlib/issues/2699"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d0089143-d1f4-bdb0-d831-239cbd15c0dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED2C:290D1F:8D6A9A:BE24A4:6A530EBF |
| html-safe-nonce | 62fae33bd8d5d19ae59a45c5eb62612dbf0866caf36de6a92facdf22ea818218 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDJDOjI5MEQxRjo4RDZBOUE6QkUyNEE0OjZBNTMwRUJGIiwidmlzaXRvcl9pZCI6IjY0Njg1NzQxMDUxMDkyMDQ2NzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 53123f652ebab25ecc48ccc410e1eb82950f56d81bca883fb33329942a1a4731 |
| hovercard-subject-tag | issue:24871441 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/2699/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bfd61ebdb9ea58803a52c58200413c5811b195efbf9b494d4d0fb51494731b7f/matplotlib/matplotlib/issues/2699 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bfd61ebdb9ea58803a52c58200413c5811b195efbf9b494d4d0fb51494731b7f/matplotlib/matplotlib/issues/2699 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eyurtsev |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width