René's URL Explorer Experiment


Title: [Bug]: fig.tight_layout when quiver collection is clipped produces AttributeError · Issue #24104 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: fig.tight_layout when quiver collection is clipped produces AttributeError · Issue #24104 · matplotlib/matplotlib

X Title: [Bug]: fig.tight_layout when quiver collection is clipped produces AttributeError · Issue #24104 · matplotlib/matplotlib

Description: Bug summary When I set a clipping path to quiver object with set_clip_path(), Figure.tight_layout() produces AttributeError: 'NoneType' object has no attribute 'xmin'. Without tight_layout() everything works. Code for reproduction import...

Open Graph Description: Bug summary When I set a clipping path to quiver object with set_clip_path(), Figure.tight_layout() produces AttributeError: 'NoneType' object has no attribute 'xmin'. Without tight_layout() everyt...

X Description: Bug summary When I set a clipping path to quiver object with set_clip_path(), Figure.tight_layout() produces AttributeError: 'NoneType' object has no attribute 'xmin'. Without tight...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: fig.tight_layout when quiver collection is clipped produces AttributeError","articleBody":"### Bug summary\r\n\r\nWhen I set a clipping path to quiver object with set_clip_path(), Figure.tight_layout() produces AttributeError: 'NoneType' object has no attribute 'xmin'. Without tight_layout() everything works.\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.patches import Circle\r\n\r\nx, y = np.mgrid[-1:1:0.1, -1:1:0.1]\r\nz = np.sin(x) + np.cos(y)\r\nxg, yg = np.gradient(z)\r\n\r\nf, ax = plt.subplots()\r\nh = ax.quiver(x, y, xg, yg, label='Test')\r\nc = Circle((0, 0), radius=1, edgecolor=\"black\", fill=False)\r\nax.add_patch(c)\r\nh.set_clip_path(c)\r\nax.set_aspect(1)\r\nf.tight_layout()\r\n```\r\n\r\n\r\n### Actual outcome\r\n```\r\n---------------------------------------------------------------------------\r\nAttributeError                            Traceback (most recent call last)\r\nCell In [42], line 15\r\n     13 h.set_clip_path(c)\r\n     14 ax.set_aspect(1)\r\n---\u003e 15 f.tight_layout()\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/figure.py:3443, in Figure.tight_layout(self, pad, h_pad, w_pad, rect)\r\n   3441 try:\r\n   3442     self.set_layout_engine(engine)\r\n-\u003e 3443     engine.execute(self)\r\n   3444 finally:\r\n   3445     self.set_layout_engine(None)\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/layout_engine.py:180, in TightLayoutEngine.execute(self, fig)\r\n    178 renderer = fig._get_renderer()\r\n    179 with getattr(renderer, \"_draw_disabled\", nullcontext)():\r\n--\u003e 180     kwargs = get_tight_layout_figure(\r\n    181         fig, fig.axes, subplotspec_list, renderer,\r\n    182         pad=info['pad'], h_pad=info['h_pad'], w_pad=info['w_pad'],\r\n    183         rect=info['rect'])\r\n    184 if kwargs:\r\n    185     fig.subplots_adjust(**kwargs)\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/_tight_layout.py:305, in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect)\r\n    300         return {}\r\n    301     span_pairs.append((\r\n    302         slice(ss.rowspan.start * div_row, ss.rowspan.stop * div_row),\r\n    303         slice(ss.colspan.start * div_col, ss.colspan.stop * div_col)))\r\n--\u003e 305 kwargs = _auto_adjust_subplotpars(fig, renderer,\r\n    306                                   shape=(max_nrows, max_ncols),\r\n    307                                   span_pairs=span_pairs,\r\n    308                                   subplot_list=subplot_list,\r\n    309                                   ax_bbox_list=ax_bbox_list,\r\n    310                                   pad=pad, h_pad=h_pad, w_pad=w_pad)\r\n    312 # kwargs can be none if tight_layout fails...\r\n    313 if rect is not None and kwargs is not None:\r\n    314     # if rect is given, the whole subplots area (including\r\n    315     # labels) will fit into the rect instead of the\r\n   (...)\r\n    319     # auto_adjust_subplotpars twice, where the second run\r\n    320     # with adjusted rect parameters.\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/_tight_layout.py:82, in _auto_adjust_subplotpars(fig, renderer, shape, span_pairs, subplot_list, ax_bbox_list, pad, h_pad, w_pad, rect)\r\n     80 for ax in subplots:\r\n     81     if ax.get_visible():\r\n---\u003e 82         bb += [martist._get_tightbbox_for_layout_only(ax, renderer)]\r\n     84 tight_bbox_raw = Bbox.union(bb)\r\n     85 tight_bbox = fig.transFigure.inverted().transform_bbox(tight_bbox_raw)\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/artist.py:1378, in _get_tightbbox_for_layout_only(obj, *args, **kwargs)\r\n   1372 \"\"\"\r\n   1373 Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a\r\n   1374 *for_layout_only* kwarg; this helper tries to uses the kwarg but skips it\r\n   1375 when encountering third-party subclasses that do not support it.\r\n   1376 \"\"\"\r\n   1377 try:\r\n-\u003e 1378     return obj.get_tightbbox(*args, **{**kwargs, \"for_layout_only\": True})\r\n   1379 except TypeError:\r\n   1380     return obj.get_tightbbox(*args, **kwargs)\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/axes/_base.py:4450, in _AxesBase.get_tightbbox(self, renderer, call_axes_locator, bbox_extra_artists, for_layout_only)\r\n   4447     bbox_artists = self.get_default_bbox_extra_artists()\r\n   4449 for a in bbox_artists:\r\n-\u003e 4450     bbox = a.get_tightbbox(renderer)\r\n   4451     if (bbox is not None\r\n   4452             and 0 \u003c bbox.width \u003c np.inf\r\n   4453             and 0 \u003c bbox.height \u003c np.inf):\r\n   4454         bb.append(bbox)\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/artist.py:345, in Artist.get_tightbbox(self, renderer)\r\n    343     if clip_path is not None:\r\n    344         clip_path = clip_path.get_fully_transformed_path()\r\n--\u003e 345         bbox = Bbox.intersection(bbox, clip_path.get_extents())\r\n    346 return bbox\r\n\r\nFile ~/miniforge3/envs/apsg/lib/python3.10/site-packages/matplotlib/transforms.py:666, in BboxBase.intersection(bbox1, bbox2)\r\n    660 @staticmethod\r\n    661 def intersection(bbox1, bbox2):\r\n    662     \"\"\"\r\n    663     Return the intersection of *bbox1* and *bbox2* if they intersect, or\r\n    664     None if they don't.\r\n    665     \"\"\"\r\n--\u003e 666     x0 = np.maximum(bbox1.xmin, bbox2.xmin)\r\n    667     x1 = np.minimum(bbox1.xmax, bbox2.xmax)\r\n    668     y0 = np.maximum(bbox1.ymin, bbox2.ymin)\r\n\r\nAttributeError: 'NoneType' object has no attribute 'xmin'\r\n```\r\n\r\n### Expected outcome\r\n\r\nNo error\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Operating system\r\n\r\nUbuntu\r\n\r\n### Matplotlib Version\r\n\r\n3.6.0\r\n\r\n### Matplotlib Backend\r\n\r\nmodule://matplotlib_inline.backend_inline\r\n\r\n### Python version\r\n\r\n3.10.6\r\n\r\n### Jupyter version\r\n\r\n3.4.8\r\n\r\n### Installation\r\n\r\nconda","author":{"url":"https://github.com/ondrolexa","@type":"Person","name":"ondrolexa"},"datePublished":"2022-10-06T11:31:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/24104/matplotlib/issues/24104"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f13a9a98-3983-5058-10dd-6d085daac064
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB922:19F60D:250885C:313BEA4:6A520D48
html-safe-nonce12ebc644d774d14dcf88ec0f8ae7928a80ba62b50b309442bdf3d8069850d4a1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTIyOjE5RjYwRDoyNTA4ODVDOjMxM0JFQTQ6NkE1MjBENDgiLCJ2aXNpdG9yX2lkIjoiMjUxNDE4Njc0MjA0MDQ5NzQ4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac888b33e834acac5561a98e355baaf0cc8d01d3682d1acdc05dd01ddcb047e344
hovercard-subject-tagissue:1399419807
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/24104/issue_layout
twitter:imagehttps://opengraph.githubassets.com/07111881fbd7a0c54678a4efcd13a46880d522d2853c4283eb395853c20f79b6/matplotlib/matplotlib/issues/24104
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/07111881fbd7a0c54678a4efcd13a46880d522d2853c4283eb395853c20f79b6/matplotlib/matplotlib/issues/24104
og:image:altBug summary When I set a clipping path to quiver object with set_clip_path(), Figure.tight_layout() produces AttributeError: 'NoneType' object has no attribute 'xmin'. Without tight_layout() everyt...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameondrolexa
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
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
release7aed05249554b889eb33d002851a973eebcc7e91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/24104#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F24104
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%2F24104
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/24104
Reloadhttps://github.com/matplotlib/matplotlib/issues/24104
Reloadhttps://github.com/matplotlib/matplotlib/issues/24104
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/24104
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/24104
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 409 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
[Bug]: fig.tight_layout when quiver collection is clipped produces AttributeErrorhttps://github.com/matplotlib/matplotlib/issues/24104#top
v3.8.0https://github.com/matplotlib/matplotlib/milestone/77
https://github.com/ondrolexa
ondrolexahttps://github.com/ondrolexa
on Oct 6, 2022https://github.com/matplotlib/matplotlib/issues/24104#issue-1399419807
v3.8.0https://github.com/matplotlib/matplotlib/milestone/77
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.