Title: index in pick_event invalid and inconsistent for mplot3d scatter plot (z ordering?) · Issue #19735 · matplotlib/matplotlib · GitHub
Open Graph Title: index in pick_event invalid and inconsistent for mplot3d scatter plot (z ordering?) · Issue #19735 · matplotlib/matplotlib
X Title: index in pick_event invalid and inconsistent for mplot3d scatter plot (z ordering?) · Issue #19735 · matplotlib/matplotlib
Description: Bug report Bug summary The index returned in the pick_event (event.ind) does not correspond to the index of the source data. It also changes depending on the view onto the data. The example contains two points. When you click on a point,...
Open Graph Description: Bug report Bug summary The index returned in the pick_event (event.ind) does not correspond to the index of the source data. It also changes depending on the view onto the data. The example contain...
X Description: Bug report Bug summary The index returned in the pick_event (event.ind) does not correspond to the index of the source data. It also changes depending on the view onto the data. The example contain...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/19735
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"index in pick_event invalid and inconsistent for mplot3d scatter plot (z ordering?)","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nThe index returned in the pick_event (event.ind) does not correspond to the index of the source data.\r\nIt also changes depending on the view onto the data.\r\n\r\nThe example contains two points. \r\nWhen you click on a point, the event.ind is printed out.\r\nThe one at (0,0,0) should have index 0, the other index 1.\r\n\r\nRotate the plot so that the second point is further behind (semi transparent). Now it has index 0. \r\nRotate the plot so that the second point is further in front (full opacity). Now it has index 1.\r\n\r\n**Code for reproduction**\r\n\r\n`\r\n```python\r\nimport numpy as np\r\nimport matplotlib\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n\r\n\r\nif __name__ == \"__main__\":\r\n fig = plt.figure(constrained_layout=True, figsize=(6,6))\r\n\r\n ax = fig.add_subplot(111, projection='3d')\r\n\r\n num_points = 2\r\n data = np.zeros([num_points,3])\r\n data[:,0] = np.linspace(1,0,num_points)\r\n print(data)\r\n\r\n path_collection = ax.scatter(xs=data[:,0],\r\n ys=data[:,1],\r\n zs=data[:,2],\r\n picker=True)\r\n\r\n ax.set_xlabel(\"x\")\r\n ax.set_ylabel(\"y\")\r\n ax.set_zlabel(\"z\")\r\n ax.set_xlim(-1,1)\r\n ax.set_ylim(-1,1)\r\n ax.set_zlim(-1,1)\r\n\r\n def onpick(event):\r\n print(event.ind)\r\n\r\n fig.canvas.mpl_connect('pick_event', onpick)\r\n\r\n plt.show()`\r\n```\r\n\r\n**Actual outcome**\r\n\r\nThe example contains two points. \r\nWhen you click on a point, the event.ind is printed out.\r\nThe one at (0,0,0) should have index 0, the other index 1.\r\n\r\nRotate the plot so that the second point is further behind (semi transparent). Now it has index 0. \r\nRotate the plot so that the second point is further in front (full opacity). Now it has index 1.\r\n\r\n**Expected outcome**\r\n\r\nThe returned event.ind should not depend on view.\r\nFor the point in the centre it should always return 0, for the point to the right, it should always return 1.\r\n\r\n**Matplotlib version**\r\n * Operating system: macOS Catalina; 10.15.4\r\n * Matplotlib version (`import matplotlib; print(matplotlib.__version__)`): '3.3.4'\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): 'MacOSX'\r\n * Python version: Python 3.6.9\r\n * Jupyter version (if applicable): \r\n * Other libraries: \r\n\r\n","author":{"url":"https://github.com/saasbk","@type":"Person","name":"saasbk"},"datePublished":"2021-03-18T15:24:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/19735/matplotlib/issues/19735"}
| 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:feb02879-0d4d-4d6c-d855-b3019d05a244 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDD8:2BD65D:5B7FBC:79DF2E:6A519A62 |
| html-safe-nonce | 5b267f931672fd49c4a8159981aa30135def6ccbe2db028a53423fe19f85b447 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREQ4OjJCRDY1RDo1QjdGQkM6NzlERjJFOjZBNTE5QTYyIiwidmlzaXRvcl9pZCI6Ijg1MTI4MDQ1MTMzOTM5MzYzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 14a302c940e2a5becf22c9e0a9e9879f74f66b9eef7d346ffa318846be7442d4 |
| hovercard-subject-tag | issue:834939229 |
| 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/19735/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2184f1c24724eca02fc8e74f7d6e9a8545b81aa2965f9fd038aac5229c18a470/matplotlib/matplotlib/issues/19735 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2184f1c24724eca02fc8e74f7d6e9a8545b81aa2965f9fd038aac5229c18a470/matplotlib/matplotlib/issues/19735 |
| og:image:alt | Bug report Bug summary The index returned in the pick_event (event.ind) does not correspond to the index of the source data. It also changes depending on the view onto the data. The example contain... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | saasbk |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width