Title: [Bug]: Adding contour labels affects the shape of filled contours · Issue #31344 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Adding contour labels affects the shape of filled contours · Issue #31344 · matplotlib/matplotlib
X Title: [Bug]: Adding contour labels affects the shape of filled contours · Issue #31344 · matplotlib/matplotlib
Description: Bug summary The shape of the filled contours changes unexpectedly when I add the contour labels by calling axs[1].clabel(CS). Code for reproduction import matplotlib.pyplot as plt import numpy as np delta = 0.025 x = np.arange(-3.0, 3.0,...
Open Graph Description: Bug summary The shape of the filled contours changes unexpectedly when I add the contour labels by calling axs[1].clabel(CS). Code for reproduction import matplotlib.pyplot as plt import numpy as n...
X Description: Bug summary The shape of the filled contours changes unexpectedly when I add the contour labels by calling axs[1].clabel(CS). Code for reproduction import matplotlib.pyplot as plt import numpy as n...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31344
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Adding contour labels affects the shape of filled contours","articleBody":"### Bug summary\n\nThe shape of the filled contours changes unexpectedly when I add the contour labels by calling `axs[1].clabel(CS)`.\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\nimport numpy as np\n\ndelta = 0.025\nx = np.arange(-3.0, 3.0, delta)\ny = np.arange(-2.0, 2.0, delta)\nX, Y = np.meshgrid(x, y)\nZ1 = np.exp(-X**2 - Y**2)\nZ2 = np.exp(-(X - 1)**2 - (Y - 1)**2)\nZ = (Z1 - Z2) * 2\n\nfig, axs = plt.subplots(2, 1)\naxs[0].contourf(X, Y, Z)\nCS = axs[1].contourf(X, Y, Z)\nlabels = axs[1].clabel(CS)\nplt.show()\n```\n\n### Actual outcome\n\n\u003cimg width=\"546\" height=\"413\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/9c8d4415-e78d-4abf-98d9-c2098cd7a37d\" /\u003e\n\n### Expected outcome\n\n\u003cimg width=\"546\" height=\"413\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/f91440cd-fbe6-4e0d-9663-2d857b9c3e05\" /\u003e\n\n### Additional information\n\n_No response_\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n0.2.0.dev53938+unknown.gd5f597d3d.g0f46f27f5\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/williamlus","@type":"Person","name":"williamlus"},"datePublished":"2026-03-21T07:31:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/31344/matplotlib/issues/31344"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:26ba322e-a8b3-bf0d-dc78-e43bdfe1b6b8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9494:32A102:9316BB:C4DD03:6A52AF75 |
| html-safe-nonce | 306fc2f3ac06756deb1717ead414c828b387b40341c6be7e085d7ee5e06aacbb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDk0OjMyQTEwMjo5MzE2QkI6QzRERDAzOjZBNTJBRjc1IiwidmlzaXRvcl9pZCI6IjQ5NjQ2ODkwOTg4MDE1OTAxMzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5310f901cb91b1f74624a41d74f065aa10b973f95e8b0bef4953250c78d1514a |
| hovercard-subject-tag | issue:4111727374 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/matplotlib/matplotlib/31344/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a6e28f43138ee8664899eea76f5ac0679d97d8882ab264871ffff1e4710bb75f/matplotlib/matplotlib/issues/31344 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a6e28f43138ee8664899eea76f5ac0679d97d8882ab264871ffff1e4710bb75f/matplotlib/matplotlib/issues/31344 |
| og:image:alt | Bug summary The shape of the filled contours changes unexpectedly when I add the contour labels by calling axs[1].clabel(CS). Code for reproduction import matplotlib.pyplot as plt import numpy as n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | williamlus |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width