René's URL Explorer Experiment


Title: [Bug]: PDF backend culls visible `hexbin` cells after path collection optimization · Issue #31999 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: PDF backend culls visible `hexbin` cells after path collection optimization · Issue #31999 · matplotlib/matplotlib

X Title: [Bug]: PDF backend culls visible `hexbin` cells after path collection optimization · Issue #31999 · matplotlib/matplotlib

Description: Bug summary Matplotlib 3.11.0 introduced PDF backend culling for path collections to avoid very large PDFs when many colored scatter markers are outside the visible canvas (#30746). This works for scatter, but it incorrectly clips hexbin...

Open Graph Description: Bug summary Matplotlib 3.11.0 introduced PDF backend culling for path collections to avoid very large PDFs when many colored scatter markers are outside the visible canvas (#30746). This works for ...

X Description: Bug summary Matplotlib 3.11.0 introduced PDF backend culling for path collections to avoid very large PDFs when many colored scatter markers are outside the visible canvas (#30746). This works for ...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31999

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: PDF backend culls visible `hexbin` cells after path collection optimization","articleBody":"### Bug summary\n\nMatplotlib 3.11.0 introduced PDF backend culling for path collections to avoid very large PDFs when many colored `scatter` markers are outside the visible canvas (https://github.com/matplotlib/matplotlib/pull/30746). This works for `scatter`, but it incorrectly clips `hexbin` output when the `hexbin` offsets include negative coordinates.\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nrng = np.random.default_rng(19680801)\nx = rng.normal(size=10_000)\ny = rng.normal(size=10_000)\n\nfig, ax = plt.subplots()\nax.hexbin(x, y, gridsize=25, edgecolors=\"none\")\nfig.savefig(\"hexbin.png\")\nfig.savefig(\"hexbin.pdf\")\n```\n\n### Actual outcome\n\nThe above code produces [hexbin.pdf](https://github.com/user-attachments/files/29671979/hexbin.pdf). Converting it to PNG with `magick` shows: \u003cimg width=\"461\" height=\"346\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/630c2a42-faed-49b3-8a6d-fb7888da0793\" /\u003e\n\n### Expected outcome\n\nThe above happens only for the PDF backend. For the PNG format, it is rendered as expected as below. \u003cimg width=\"640\" height=\"480\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/7bc83942-522f-4d5a-9159-5aeafe79f531\" /\u003e\n\n### Additional information\n\nThe key difference from `scatter` is how the collections are transformed. For `scatter`, the collection offsets transformed by `offset_transform` are the actual marker centers in canvas/display coordinates, and the marker path is centered around that offset. Therefore, checking whether the offset plus marker extent intersects the PDF canvas is valid.\n\nFor `hexbin`, the collection is built from one reusable hexagon path plus many offsets, but the offsets are transformed with `AffineDeltaTransform(self.transData)`. That transform intentionally removes the translation component from `transData`, so the transformed offsets are displacement vectors, not full canvas-space marker centers. The missing translation is carried by the transformed prototype path. The PDF backend culling logic treated those displacement offsets as if they were absolute canvas positions, so visible hexagons with negative offsets were skipped. This makes the PDF output lose part of the `hexbin` plot, while raster backends such as Agg/PNG render correctly.\n\nThis issue can be fixed, with keeping the PR #30746 optimization, but by culling using the final translated path bounds rather than assuming the transformed offset alone is the marker center. This preserves the `scatter` PDF size optimization while correctly handling `hexbin` and any other path collection whose offset transform is not an absolute canvas-position transform.\n\n### Operating system\n\nmacOS Sequoia 15.6\n\n### Matplotlib Version\n\n3.11.0\n\n### Matplotlib Backend\n\nPDF\n\n### Python version\n\n3.13\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nNone","author":{"url":"https://github.com/yuzie007","@type":"Person","name":"yuzie007"},"datePublished":"2026-07-05T09:41:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/31999/matplotlib/issues/31999"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:da5abfa4-904a-59bc-5be9-1f9b276f66e7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE2BC:5BE42:25E478:352297:6A4E67A3
html-safe-nonce65927495d22d31cd3c1f7eaf7f897f43414d90ee71fb2037a511be039aee1068
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkJDOjVCRTQyOjI1RTQ3ODozNTIyOTc6NkE0RTY3QTMiLCJ2aXNpdG9yX2lkIjoiMzM3MDg1MzE3Mzk0NjIyMzcxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3c8a114b3b4e75f8d418009a5404e4848d94b792058558e17fbfde29efc3a8f0
hovercard-subject-tagissue:4812347414
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/31999/issue_layout
twitter:imagehttps://opengraph.githubassets.com/31afa061f30146525d71684e9bd89a112ae82c4122bcf7b48f1303c6a714a2d0/matplotlib/matplotlib/issues/31999
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/31afa061f30146525d71684e9bd89a112ae82c4122bcf7b48f1303c6a714a2d0/matplotlib/matplotlib/issues/31999
og:image:altBug summary Matplotlib 3.11.0 introduced PDF backend culling for path collections to avoid very large PDFs when many colored scatter markers are outside the visible canvas (#30746). This works for ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyuzie007
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/31999#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31999
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31999
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/31999
Reloadhttps://github.com/matplotlib/matplotlib/issues/31999
Reloadhttps://github.com/matplotlib/matplotlib/issues/31999
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/31999
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/31999
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 410 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
#32000https://github.com/matplotlib/matplotlib/pull/32000
[Bug]: PDF backend culls visible hexbin cells after path collection optimizationhttps://github.com/matplotlib/matplotlib/issues/31999#top
#32000https://github.com/matplotlib/matplotlib/pull/32000
v3.11.1https://github.com/matplotlib/matplotlib/milestone/108
https://github.com/yuzie007
yuzie007https://github.com/yuzie007
on Jul 5, 2026https://github.com/matplotlib/matplotlib/issues/31999#issue-4812347414
#30746https://github.com/matplotlib/matplotlib/pull/30746
hexbin.pdfhttps://github.com/user-attachments/files/29671979/hexbin.pdf
https://private-user-images.githubusercontent.com/10278010/617194429-630c2a42-faed-49b3-8a6d-fb7888da0793.png?jwt=eyJ0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QTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzA4VDE1MDcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiZDBlY2JlOTA4MTRhZGY4NmUyMDIyYjc4NjM3NzA0YjY2NDM2MzgxMDFiYWQzN2Y2M2FiOTcyZmRkNzcxZTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.i-lBpTTUjH002kuGo8RjW5idZmbAnb8ydqcH7N42Nn4
#30746https://github.com/matplotlib/matplotlib/pull/30746
v3.11.1No due datehttps://github.com/matplotlib/matplotlib/milestone/108
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.