René's URL Explorer Experiment


Title: [Bug]: contour/contourf silently produces nonsense levels when Z is constant (zmin == zmax) · Issue #31493 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: contour/contourf silently produces nonsense levels when Z is constant (zmin == zmax) · Issue #31493 · matplotlib/matplotlib

X Title: [Bug]: contour/contourf silently produces nonsense levels when Z is constant (zmin == zmax) · Issue #31493 · matplotlib/matplotlib

Description: Bug summary When Z has no variation (all values are equal), contour and contourf silently produce multiple identical levels and render empty collections with no warning to the user. The plot appears blank or broken with no indication of ...

Open Graph Description: Bug summary When Z has no variation (all values are equal), contour and contourf silently produce multiple identical levels and render empty collections with no warning to the user. The plot appear...

X Description: Bug summary When Z has no variation (all values are equal), contour and contourf silently produce multiple identical levels and render empty collections with no warning to the user. The plot appear...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: contour/contourf silently produces nonsense levels when Z is constant (zmin == zmax)","articleBody":"### Bug summary\n\n**When Z has no variation (all values are equal), contour and contourf silently \nproduce multiple identical levels and render empty collections with no warning \nto the user. The plot appears blank or broken with no indication of why.**\n\n### Code for reproduction\n\n```Python\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nZ = np.ones((10, 10)) * 5.0  # constant Z\n\nfig, (ax1, ax2) = plt.subplots(1, 2)\ncs1 = ax1.contour(np.linspace(0, 1, 10), np.linspace(0, 1, 10), Z)\ncs2 = ax2.contourf(np.linspace(0, 1, 10), np.linspace(0, 1, 10), Z)\n\nprint(f\"contour levels:  {cs1.levels}\")   # [5. 5. 5. 5. 5. 5. 5. 5.]\nprint(f\"contourf levels: {cs2.levels}\")   # [5. 5. 5. 5. 5. 5. 5. 5.]\nprint(f\"contour paths:   {cs1.get_paths()}\")  # all empty\n```\n\n### Actual outcome\n\ncontour levels:  [5. 5. 5. 5. 5. 5. 5. 5.]\ncontourf levels: [5. 5. 5. 5. 5. 5. 5. 5.]\nNo UserWarning raised. Plot is blank. User has no indication of why.\n\n### Expected outcome\n\nA UserWarning should be raised:\n\"No contour levels can be computed: Z has no variation (min == max == 5.0).\"\n\nSimilar to the existing warning \"No contour levels were found within the data \nrange\" which fires when user-supplied levels are out of range — but that \nwarning never fires for the auto-level case when zmin == zmax.\n\n### Additional information\n\nRoot cause is in contour.py around line 1364-1370. After zmin and zmax are \ncomputed from Z, there is no check for zmin == zmax before _process_contour_level_args \nis called. When zmin == zmax, MaxNLocator.tick_values() returns identical values, \nthe i1 - i0 \u003c 3 fallback at line 1002 triggers, and the full array of identical \nlevels is returned silently.\n\nThe fix is a one-block addition right after line 1365:\n\n    if self.zmin == self.zmax:\n        _api.warn_external(\n            f\"No contour levels can be computed: Z has no variation \"\n            f\"(min == max == {self.zmin}).\"\n        )\n\nThis is consistent with the logscale warning pattern directly below it.\n\n### Operating system\n\nLinux\n\n### Matplotlib Version\n\n3.10.8\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nNone","author":{"url":"https://github.com/buddy0452004","@type":"Person","name":"buddy0452004"},"datePublished":"2026-04-13T07:18:06Z","url":"https://github.com/matplotlib/matplotlib/issues/31493"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:243e48d3-8af2-9c1d-49fc-55fe4d687ffd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAEBC:3F8E32:E46EF3:135BB7D:6B06535E
html-safe-nonce44a58b8f9a2c4cdddd5ca9464854ab43e368fd7310610113b927a7a8f3190fd9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRUJDOjNGOEUzMjpFNDZFRjM6MTM1QkI3RDo2QjA2NTM1RSIsInZpc2l0b3JfaWQiOiI3NTcyMTc2OTk0MTg5MDcxMTk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacc342136790e0376e7517de942e1997b04dc4d082c5a13849878c2bf2afe7b9f3
hovercard-subject-tagissue:4252139057
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/31493/issue_layout
twitter:imagehttps://opengraph.githubassets.com/25b2287427c94ca126c0bbf8e48bbbb2e9eba2cdb0d010217376ba9c464c5916/matplotlib/matplotlib/issues/31493
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/25b2287427c94ca126c0bbf8e48bbbb2e9eba2cdb0d010217376ba9c464c5916/matplotlib/matplotlib/issues/31493
og:image:altBug summary When Z has no variation (all values are equal), contour and contourf silently produce multiple identical levels and render empty collections with no warning to the user. The plot appear...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebuddy0452004
hostnamegithub.com
expected-hostnamegithub.com
None772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e
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
releasef1f9a08f7c769a37f1dfc18ad43d463c222a7eea
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/31493#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31493
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F31493
Sign uphttps://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/31493
Reloadhttps://github.com/matplotlib/matplotlib/issues/31493
Reloadhttps://github.com/matplotlib/matplotlib/issues/31493
matplotlibhttps://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Codehttps://github.com/matplotlib/matplotlib
Issues1k (1k)https://github.com/matplotlib/matplotlib/issues
Pull requests430 (430)https://github.com/matplotlib/matplotlib/pulls
Actionshttps://github.com/matplotlib/matplotlib/actions
Projectshttps://github.com/matplotlib/matplotlib/projects
Wikihttps://github.com/matplotlib/matplotlib/wiki
Security and qualityhttps://github.com/matplotlib/matplotlib/security
Insightshttps://github.com/matplotlib/matplotlib/insights
https://github.com/matplotlib/matplotlib
New issuehttps://github.com/login?return_to=https://github.com/matplotlib/matplotlib/issues/31493
New issuehttps://github.com/login?return_to=https://github.com/matplotlib/matplotlib/issues/31493
#32645https://github.com/matplotlib/matplotlib/pull/32645
[Bug]: contour/contourf silently produces nonsense levels when Z is constant (zmin == zmax)https://github.com/matplotlib/matplotlib/issues/31493#top
#32645https://github.com/matplotlib/matplotlib/pull/32645
topic: contourhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20contour%22
topic: plotting methodshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20plotting%20methods%22
https://github.com/buddy0452004
buddy0452004https://github.com/buddy0452004
on Apr 13, 2026https://github.com/matplotlib/matplotlib/issues/31493#issue-4252139057
https://github.com/timhoffm
timhoffmhttps://github.com/timhoffm
on Apr 13, 2026https://github.com/matplotlib/matplotlib/issues/31493#issuecomment-4234931761
https://github.com/rcomer
rcomerhttps://github.com/rcomer
on Apr 13, 2026https://github.com/matplotlib/matplotlib/issues/31493#issuecomment-4235188409
https://private-user-images.githubusercontent.com/10599679/577262741-b18f9a03-bd12-4865-90d0-6a84c16da646.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTU1NzY5NzEsIm5iZiI6MTc5NTU3NjY3MSwicGF0aCI6Ii8xMDU5OTY3OS81NzcyNjI3NDEtYjE4ZjlhMDMtYmQxMi00ODY1LTkwZDAtNmE4NGMxNmRhNjQ2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTI1VDAzMTc1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5ZGFlMGUzNGQ2YjkzMjc1OTA3ZGJiNWM5YzA0YWU5NTk4NjBiNjY0OTBiMTk1Y2FjZDZmNTc1NzI0ODYxZGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.ybu1mor_pjFdanw1hnCrKbW4c4olrEjWiJfXyPy6GYA
matplotlib/lib/matplotlib/contour.pyhttps://github.com/matplotlib/matplotlib/blob/bfb292865f12c6daa12d9b7dfbfa1d25968fe2cd/lib/matplotlib/contour.py#L1397
bfb2928https://github.com/matplotlib/matplotlib/commit/bfb292865f12c6daa12d9b7dfbfa1d25968fe2cd
https://github.com/buddy0452004
buddy0452004https://github.com/buddy0452004
on Apr 13, 2026https://github.com/matplotlib/matplotlib/issues/31493#issuecomment-4235282534
@rcomerhttps://github.com/rcomer
melissawmhttps://github.com/melissawm
topic: plotting methodshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20plotting%20methods%22
topic: contourhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20contour%22
on Apr 14, 2026https://github.com/matplotlib/matplotlib/issues/31493#event-24503950359
Sign up for freehttps://github.com/signup?return_to=https://github.com/matplotlib/matplotlib/issues/31493
Sign in to commenthttps://github.com/login?return_to=https://github.com/matplotlib/matplotlib/issues/31493
topic: contourhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20contour%22
topic: plotting methodshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20plotting%20methods%22
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.