Title: Fix PDF path collection culling for `hexbin` offsets by yuzie007 · Pull Request #32000 · matplotlib/matplotlib · GitHub
Open Graph Title: Fix PDF path collection culling for `hexbin` offsets by yuzie007 · Pull Request #32000 · matplotlib/matplotlib
X Title: Fix PDF path collection culling for `hexbin` offsets by yuzie007 · Pull Request #32000 · matplotlib/matplotlib
Description: PR summary This PR fixes a PDF backend regression where visible hexbin cells can be incorrectly skipped in Matplotlib 3.11.0. Closes #31999. PR #30746 added path collection culling to the PDF backend to avoid bloated PDFs when many colored scatter markers are fully outside the canvas. That optimization works for scatter, where transformed offsets correspond to marker centers in canvas coordinates. However, hexbin uses a repeated hexagon path with offsets transformed by AffineDeltaTransform(self.transData). Those transformed offsets are displacements, not absolute canvas-space marker centers. The PDF backend was culling collections by checking the transformed offset plus an approximate marker extent. For hexbin, this can classify visible cells as off-canvas, especially when offsets are negative, so the PDF output loses part of the plot while raster output renders correctly. This PR keeps the optimization from #30746, but changes the culling check to use the actual transformed reusable path bounds translated by each offset. This preserves PDF size improvements for truly off-canvas scatter markers while correctly rendering hexbin and other collections whose transformed offsets are not absolute marker centers. This fix make the example in #31999 work as expected. A PDF regression test for hexbin with negative offsets, compared against an equivalent shifted reference. AI Disclosure Agentic AI was employed to identify the origin of the issue, make the original fix, add the original test, and write the original issue and the PR description. The AI suggestions were reviewed and polished by human. PR checklist "closes #0000" is in the body of the PR description to link the related issue new and changed code is tested Plotting related features are demonstrated in an example New Features and API Changes are noted with a directive and release note Documentation complies with general and docstring guidelines
Open Graph Description: PR summary This PR fixes a PDF backend regression where visible hexbin cells can be incorrectly skipped in Matplotlib 3.11.0. Closes #31999. PR #30746 added path collection culling to the PDF backe...
X Description: PR summary This PR fixes a PDF backend regression where visible hexbin cells can be incorrectly skipped in Matplotlib 3.11.0. Closes #31999. PR #30746 added path collection culling to the PDF backe...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/32000
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:01fb541e-11bc-732f-d660-ebd9dd20378d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D804:E1B7B:100CEE0:177BB6E:6A4E3745 |
| html-safe-nonce | 8b156214f278f57ccd8ce2d70cfed08fea0201e8fa4cbaefd4e473b5c55d18a0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODA0OkUxQjdCOjEwMENFRTA6MTc3QkI2RTo2QTRFMzc0NSIsInZpc2l0b3JfaWQiOiIyODMwMTAzODEzMTE2ODAyODg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 60550389d237735fba02686719cea87e78272c09f563cecdf1bf2015e02533e6 |
| hovercard-subject-tag | pull_request:3993251677 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/32000/files |
| twitter:image | https://avatars.githubusercontent.com/u/10278010?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/10278010?s=400&v=4 |
| og:image:alt | PR summary This PR fixes a PDF backend regression where visible hexbin cells can be incorrectly skipped in Matplotlib 3.11.0. Closes #31999. PR #30746 added path collection culling to the PDF backe... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 42a6d378d7587a44c93aca255096cd66b7c8eb2d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width