René's URL Explorer Experiment


Title: [Bug]: ValueError ("cannot convert float NaN to integer") when trying to show horizontally-stacked subplots · Issue #31881 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: ValueError ("cannot convert float NaN to integer") when trying to show horizontally-stacked subplots · Issue #31881 · matplotlib/matplotlib

X Title: [Bug]: ValueError ("cannot convert float NaN to integer") when trying to show horizontally-stacked subplots · Issue #31881 · matplotlib/matplotlib

Description: Bug summary Showing two horizontally-stacked subplots with a shared y axis and per-subplot titles fails if the y values are too large. This is a regression in matplotlib 3.11.0; it worked in 3.10.9. Code for reproduction fig, axes = plt....

Open Graph Description: Bug summary Showing two horizontally-stacked subplots with a shared y axis and per-subplot titles fails if the y values are too large. This is a regression in matplotlib 3.11.0; it worked in 3.10.9...

X Description: Bug summary Showing two horizontally-stacked subplots with a shared y axis and per-subplot titles fails if the y values are too large. This is a regression in matplotlib 3.11.0; it worked in 3.10.9...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: ValueError (\"cannot convert float NaN to integer\") when trying to show horizontally-stacked subplots","articleBody":"### Bug summary\n\nShowing two horizontally-stacked subplots with a shared y axis and per-subplot titles fails if the y values are too large. This is a regression in matplotlib 3.11.0; it worked in 3.10.9.\n\n### Code for reproduction\n\n```Python\nfig, axes = plt.subplots(1,2, figsize=(12,5), sharey=True, tight_layout=True)\n\nx = list(range(10))\ny = [1e53 for _ in x]\n\nfor i, ax in enumerate(axes):\n    ax.set_title(f'Subplot {i}')\n    ax.plot(x,y)\n\nplt.show()\n```\n\n### Actual outcome\n\n```\nTraceback (most recent call last):\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/backend_bases.py\", line 1165, in _on_timer\n    ret = func(*args, **kwargs)\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/backends/backend_macosx.py\", line 71, in callback_func\n    callback()\n    ~~~~~~~~^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/backends/backend_macosx.py\", line 93, in _draw_idle\n    self.draw()\n    ~~~~~~~~~^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/backends/backend_macosx.py\", line 56, in draw\n    super().draw()\n    ~~~~~~~~~~~~^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/backends/backend_agg.py\", line 438, in draw\n    self.figure.draw(self.renderer)\n    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/artist.py\", line 94, in draw_wrapper\n    result = draw(artist, renderer, *args, **kwargs)\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/artist.py\", line 71, in draw_wrapper\n    return draw(artist, renderer)\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/figure.py\", line 3282, in draw\n    mimage._draw_list_compositing_images(\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        renderer, self, artists, self.suppressComposite)\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/image.py\", line 133, in _draw_list_compositing_images\n    a.draw(renderer)\n    ~~~~~~^^^^^^^^^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/artist.py\", line 71, in draw_wrapper\n    return draw(artist, renderer)\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/axes/_base.py\", line 3314, in draw\n    self._update_title_position(renderer)\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/axes/_base.py\", line 3258, in _update_title_position\n    ax.yaxis.get_tightbbox(renderer)  # update offsetText\n    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/axis.py\", line 1425, in get_tightbbox\n    ticks_to_draw = self._update_ticks()\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/axis.py\", line 1344, in _update_ticks\n    major_locs = self.get_majorticklocs()\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/axis.py\", line 1673, in get_majorticklocs\n    return self.major.locator()\n           ~~~~~~~~~~~~~~~~~~^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/ticker.py\", line 2299, in __call__\n    return self.tick_values(vmin, vmax)\n           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/ticker.py\", line 2307, in tick_values\n    locs = self._raw_ticks(vmin, vmax)\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/ticker.py\", line 2237, in _raw_ticks\n    nbins = np.clip(self.axis.get_tick_space(),\n                    ~~~~~~~~~~~~~~~~~~~~~~~~^^\n  File \"/opt/miniconda3/envs/snewpy/lib/python3.13/site-packages/matplotlib/axis.py\", line 2984, in get_tick_space\n    return int(np.floor(length / size))\nValueError: cannot convert float NaN to integer\n```\n\n### Expected outcome\n\nA plot with two (very boring) subplots; as in the following example generated with matplotlib 3.10.9:\n\u003cimg width=\"1312\" height=\"676\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/991d0bdd-8764-4a7e-bcc4-71290873c964\" /\u003e\n\n### Additional information\n\nThe bug only seems to happen if three factors come together:\n* `y` becomes large enough to require scientific notation, with the `1e53` part shown at the top of the y axis. (When changing the code to `y = [1e2 for _ in x]`, the error disappears.)\n* A title is set for `axes[1]`. (When changing the code to `if i ==0: ax.set_title(f\"Subplot {i}\")`, the error disappears.)\n* The subplots are initialised with `sharey=True`. (When changing it to `False`, the error disappears.)\n\nThe same code has worked correctly in matplotlib 3.10.9 and earlier. (See “Expected Outcome” section.)\nI was also able to reproduce this bug on Ubuntu 24.04 in GitHub CI.\n\n### Operating system\n\nmacOS 15.7.7\n\n### Matplotlib Version\n\n3.11.0\n\n### Matplotlib Backend\n\nmacosx\n\n### Python version\n\n3.13.2\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/JostMigenda","@type":"Person","name":"JostMigenda"},"datePublished":"2026-06-12T18:57:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/31881/matplotlib/issues/31881"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8cebea64-747d-37b2-2595-31be777e193f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE0B6:238A8C:61584:85069:6A5232F7
html-safe-nonce7804621eadc1454257ebc218dce9e68f4e3ad135815f2290026cdfe1616ecede
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEI2OjIzOEE4Qzo2MTU4NDo4NTA2OTo2QTUyMzJGNyIsInZpc2l0b3JfaWQiOiI4MTE1MjE3NjI2Njk3OTcwNDIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8b10e90d799200d3816307d8ffb5b2e55ceee4c68b00e153ff83944d8f158413
hovercard-subject-tagissue:4651825981
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/31881/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ed5cd904bc643e7979a1145974f87db36c8ec959c19b7f1f100351d6a009fc1b/matplotlib/matplotlib/issues/31881
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ed5cd904bc643e7979a1145974f87db36c8ec959c19b7f1f100351d6a009fc1b/matplotlib/matplotlib/issues/31881
og:image:altBug summary Showing two horizontally-stacked subplots with a shared y axis and per-subplot titles fails if the y values are too large. This is a regression in matplotlib 3.11.0; it worked in 3.10.9...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJostMigenda
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/31881#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31881
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%2F31881
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/31881
Reloadhttps://github.com/matplotlib/matplotlib/issues/31881
Reloadhttps://github.com/matplotlib/matplotlib/issues/31881
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/31881
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/31881
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
#31885https://github.com/matplotlib/matplotlib/pull/31885
[Bug]: ValueError ("cannot convert float NaN to integer") when trying to show horizontally-stacked subplotshttps://github.com/matplotlib/matplotlib/issues/31881#top
#31885https://github.com/matplotlib/matplotlib/pull/31885
first-contributionhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22first-contribution%22
status: confirmed bughttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20confirmed%20bug%22
v3.11.1https://github.com/matplotlib/matplotlib/milestone/108
https://github.com/JostMigenda
JostMigendahttps://github.com/JostMigenda
on Jun 12, 2026https://github.com/matplotlib/matplotlib/issues/31881#issue-4651825981
https://private-user-images.githubusercontent.com/16189747/607310998-991d0bdd-8764-4a7e-bcc4-71290873c964.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM3NzIxOTUsIm5iZiI6MTc4Mzc3MTg5NSwicGF0aCI6Ii8xNjE4OTc0Ny82MDczMTA5OTgtOTkxZDBiZGQtODc2NC00YTdlLWJjYzQtNzEyOTA4NzNjOTY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzExVDEyMTEzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEyNGMzNTNmZGMwMGNkOGYwMjZlNTdjYTQ4MGFmNjIwOGJmMjQ3YWQ0MDQ1Mzk4ZmY1MTYxOWVlZjA2NTcwNmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.Njoj1IyWFmgMDUAloll5eMJtzDSc1RZu_TsQ7kFeRmg
first-contributionhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22first-contribution%22
status: confirmed bughttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20confirmed%20bug%22
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.