Title: Possible issue in hexbin using weights · Issue #20877 · matplotlib/matplotlib · GitHub
Open Graph Title: Possible issue in hexbin using weights · Issue #20877 · matplotlib/matplotlib
X Title: Possible issue in hexbin using weights · Issue #20877 · matplotlib/matplotlib
Description: I am facing a problem in matplotlib, using hexbin with weights (argument C=). When I am filling the C argument, not only the ouput color changes but also the shape. Here is a very simple code snippet reproducing the behavior: npts = int(...
Open Graph Description: I am facing a problem in matplotlib, using hexbin with weights (argument C=). When I am filling the C argument, not only the ouput color changes but also the shape. Here is a very simple code snipp...
X Description: I am facing a problem in matplotlib, using hexbin with weights (argument C=). When I am filling the C argument, not only the ouput color changes but also the shape. Here is a very simple code snipp...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/20877
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible issue in hexbin using weights","articleBody":"I am facing a problem in matplotlib, using hexbin with weights (argument C=).\r\n\r\nWhen I am filling the C argument, not only the ouput color changes but also the shape. Here is a very simple code snippet reproducing the behavior:\r\n\r\n```\r\n npts = int(2e5)\r\n \r\n # Create a random distribution and another one as it perturbation\r\n x1 = np.random.randint(0,3000,npts)\r\n x2 = x1 + np.random.normal(loc=0,scale=75,size=npts)\r\n \r\n # Same for the second axis variable\r\n y1 = np.random.randint(280,310,npts)\r\n y2 = y1 + np.random.normal(loc=0,scale=2,size=npts)\r\n \r\n # Plot\r\n fig, axes = plt.subplots(2,1)\r\n ax = axes[0]\r\n ax.hexbin(y2-y1,x1,mincnt=1,extent=[-8,8,0,3000], gridsize=150) \r\n #\r\n ax = axes[1]\r\n res = ax.hexbin(y2-y1,x1,C=x1,mincnt=1,extent=[-8,8,0,3000], gridsize=150)\r\n \r\n fig.savefig(f\"hexbin_weights.png\")\r\n plt.show()\r\n```\r\nAnd the corresponding output:\r\n[![Snippet output][2]][2]\r\n\r\nTo my understanding, as the x and y coordinates of the points are identical, only the color on the two plots should change. However, it is clearly not the case. Is it another parameter that is changing without me being aware of ? Is C not doing what I expect it to do ?\r\n\r\nThanks in advance for any help !\r\n\r\n [1]: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hexbin.html\r\n [2]: https://i.stack.imgur.com/LuqQR.png","author":{"url":"https://github.com/Enzoupi","@type":"Person","name":"Enzoupi"},"datePublished":"2021-08-23T11:14:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/20877/matplotlib/issues/20877"}
| 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:925271e2-857b-2fa1-5784-f781f4cc7c01 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C72E:25E8A1:149A900:1C226BD:6A53D3E5 |
| html-safe-nonce | 9c0bb387b2246e33d3bff9b3dfc4420ec2c681d9f46659cb4ad070dcda11df89 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzJFOjI1RThBMToxNDlBOTAwOjFDMjI2QkQ6NkE1M0QzRTUiLCJ2aXNpdG9yX2lkIjoiODIxOTQ5NTk1Njg5MTQ1MzE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 41c87e7f476a7678a493b66fa369464f925fe16df57aa36640384d4ad3544f72 |
| hovercard-subject-tag | issue:976917575 |
| 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/20877/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1e47d8d998805f15040e09fde0ef7bf157635c1f65c918e65057005b209d9509/matplotlib/matplotlib/issues/20877 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1e47d8d998805f15040e09fde0ef7bf157635c1f65c918e65057005b209d9509/matplotlib/matplotlib/issues/20877 |
| og:image:alt | I am facing a problem in matplotlib, using hexbin with weights (argument C=). When I am filling the C argument, not only the ouput color changes but also the shape. Here is a very simple code snipp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Enzoupi |
| 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