Title: MouseEvent.x and .y have different types · Issue #11496 · matplotlib/matplotlib · GitHub
Open Graph Title: MouseEvent.x and .y have different types · Issue #11496 · matplotlib/matplotlib
X Title: MouseEvent.x and .y have different types · Issue #11496 · matplotlib/matplotlib
Description: Bug report Bug summary MouseEvent.x is an int but MouseEvent.y is a float. Code for reproduction import numpy as np import matplotlib.pyplot as plt def onclick(event): print(event.x, event.y) print(type(event.x), type(event.y)) plt.imsho...
Open Graph Description: Bug report Bug summary MouseEvent.x is an int but MouseEvent.y is a float. Code for reproduction import numpy as np import matplotlib.pyplot as plt def onclick(event): print(event.x, event.y) print...
X Description: Bug report Bug summary MouseEvent.x is an int but MouseEvent.y is a float. Code for reproduction import numpy as np import matplotlib.pyplot as plt def onclick(event): print(event.x, event.y) print...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11496
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MouseEvent.x and .y have different types","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\n`MouseEvent.x` is an int but `MouseEvent.y` is a float.\r\n\r\n**Code for reproduction**\r\n\r\n\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\n\r\ndef onclick(event):\r\n print(event.x, event.y)\r\n print(type(event.x), type(event.y))\r\n\r\n\r\nplt.imshow(np.zeros((32, 32)))\r\nplt.gcf().canvas.mpl_connect('button_press_event', onclick)\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\nAfter randomly clicking on the image:\r\n```\r\n328 243.0\r\n\u003cclass 'int'\u003e \u003cclass 'numpy.float64'\u003e\r\n299 148.0\r\n\u003cclass 'int'\u003e \u003cclass 'numpy.float64'\u003e\r\n260 247.0\r\n\u003cclass 'int'\u003e \u003cclass 'numpy.float64'\u003e\r\n```\r\n\r\n**Expected outcome**\r\n\r\n```\r\n328 243\r\n\u003cclass 'int'\u003e \u003cclass 'int'\u003e\r\n299 148\r\n\u003cclass 'int'\u003e \u003cclass 'int'\u003e\r\n260 247\r\n\u003cclass 'int'\u003e \u003cclass 'int'\u003e\r\n```\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Ubuntu 18.04\r\n * Matplotlib version: 2.2.2 (installed from pip)\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: Python 3.6.5\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/tonyxty","@type":"Person","name":"tonyxty"},"datePublished":"2018-06-24T09:54:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/11496/matplotlib/issues/11496"}
| 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:e1cd167b-f40b-f4e9-02b2-40e01193c6cc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA98:323BC4:2CD3FF7:3C9F07A:6A53BEAE |
| html-safe-nonce | c88b5435b8da839f7fa66e0956420a5fcddaf768de3fe13aca3a47c5c741ef64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTk4OjMyM0JDNDoyQ0QzRkY3OjNDOUYwN0E6NkE1M0JFQUUiLCJ2aXNpdG9yX2lkIjoiNTQzMjM5MDUyNDU3MjI1Mzg3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cfb943ae193a94199aec12351f8e431e0d9cb320936a153356ea77274f4d5168 |
| hovercard-subject-tag | issue:335166545 |
| 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/11496/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4fc7b00729b1f07940984f49d3b80742833e589f77f4453afedf2b093a9578ad/matplotlib/matplotlib/issues/11496 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4fc7b00729b1f07940984f49d3b80742833e589f77f4453afedf2b093a9578ad/matplotlib/matplotlib/issues/11496 |
| og:image:alt | Bug report Bug summary MouseEvent.x is an int but MouseEvent.y is a float. Code for reproduction import numpy as np import matplotlib.pyplot as plt def onclick(event): print(event.x, event.y) print... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tonyxty |
| 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