Title: [Bug]: plt.clabel raises exception at very low DPI: `ValueError: 'codes' must be a 1D list or array with the same length of 'vertices'. Your vertices have shape (2, 2) but your codes have shape (1,)` · Issue #26971 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: plt.clabel raises exception at very low DPI: `ValueError: 'codes' must be a 1D list or array with the same length of 'vertices'. Your vertices have shape (2, 2) but your codes have shape (1,)` · Issue #26971 · matplotlib/matplotlib
X Title: [Bug]: plt.clabel raises exception at very low DPI: `ValueError: 'codes' must be a 1D list or array with the same length of 'vertices'. Your vertices have shape (2, 2) but your codes have shape (1,)` · Issue #26971 · matplotlib/matplotlib
Description: Bug summary This worked up to and including Matplotlib 3.7.3 and broke in Matplotlib 3.8.0. Data files for sample code below: x.txt y.txt z.txt Code for reproduction import matplotlib matplotlib.rcParams['figure.dpi'] = matplotlib.rcPara...
Open Graph Description: Bug summary This worked up to and including Matplotlib 3.7.3 and broke in Matplotlib 3.8.0. Data files for sample code below: x.txt y.txt z.txt Code for reproduction import matplotlib matplotlib.rc...
X Description: Bug summary This worked up to and including Matplotlib 3.7.3 and broke in Matplotlib 3.8.0. Data files for sample code below: x.txt y.txt z.txt Code for reproduction import matplotlib matplotlib.rc...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/26971
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: plt.clabel raises exception at very low DPI: `ValueError: 'codes' must be a 1D list or array with the same length of 'vertices'. Your vertices have shape (2, 2) but your codes have shape (1,)`","articleBody":"### Bug summary\n\nThis worked up to and including Matplotlib 3.7.3 and broke in Matplotlib 3.8.0.\r\n\r\nData files for sample code below:\r\n[x.txt](https://github.com/matplotlib/matplotlib/files/12782405/x.txt)\r\n[y.txt](https://github.com/matplotlib/matplotlib/files/12782406/y.txt)\r\n[z.txt](https://github.com/matplotlib/matplotlib/files/12782407/z.txt)\r\n\n\n### Code for reproduction\n\n```python\nimport matplotlib\r\nmatplotlib.rcParams['figure.dpi'] = matplotlib.rcParams['savefig.dpi'] = 4\r\n\r\nfrom matplotlib import pyplot as plt\r\nimport numpy as np\r\n\r\n# See data files attached above: x.txt, y.txt, z.txt\r\nx = np.loadtxt('x.txt')\r\ny = np.loadtxt('y.txt')\r\nz = np.loadtxt('z.txt')\r\n\r\nax = plt.axes()\r\ncontourset = ax.contour(x, y, z, levels=[90.0], linewidths=0.5)\r\nax.clabel(contourset)\r\nplt.savefig('test.pdf')\n```\n\n\n### Actual outcome\n\n```\r\nTraceback (most recent call last):\r\n File \"/private/tmp/test.py\", line 13, in \u003cmodule\u003e\r\n ax.clabel(contourset)\r\n File \"/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/matplotlib/axes/_axes.py\", line 6550, in clabel\r\n return CS.clabel(levels, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/matplotlib/contour.py\", line 222, in clabel\r\n self.labels(inline, inline_spacing)\r\n File \"/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/matplotlib/contour.py\", line 622, in labels\r\n rotation, path = self._split_path_and_get_label_rotation(\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/matplotlib/contour.py\", line 436, in _split_path_and_get_label_rotation\r\n return angle, Path(xys, codes)\r\n ^^^^^^^^^^^^^^^^\r\n File \"/Users/lpsinger/Library/Python/3.11/lib/python/site-packages/matplotlib/path.py\", line 135, in __init__\r\n raise ValueError(\"'codes' must be a 1D list or array with the \"\r\nValueError: 'codes' must be a 1D list or array with the same length of 'vertices'. Your vertices have shape (2, 2) but your codes have shape (1,)\r\n```\n\n### Expected outcome\n\n[test.pdf](https://github.com/matplotlib/matplotlib/files/12782396/test.pdf)\r\n\n\n### Additional information\n\nI discovered this regression in the CI pipeline from one of my own projects, in a test that sets DPI to an extremely low value for performance purposes. https://git.ligo.org/lscsoft/ligo.skymap/-/jobs/2961694\n\n### Operating system\n\nmacOS\n\n### Matplotlib Version\n\n3.8.0\n\n### Matplotlib Backend\n\nMacOSX\n\n### Python version\n\n3.11.5\n\n### Jupyter version\n\nN/A\n\n### Installation\n\npip","author":{"url":"https://github.com/lpsinger","@type":"Person","name":"lpsinger"},"datePublished":"2023-10-02T12:06:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/26971/matplotlib/issues/26971"}
| 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:b5965dd8-2c31-3eaa-f356-6cbf6453a680 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9564:2B0738:AF9B67:EE022D:6A531C52 |
| html-safe-nonce | 73d72dd6f31e77b1350fe179c52e10c608cb1d0f5ae783266923d2f384e95008 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTY0OjJCMDczODpBRjlCNjc6RUUwMjJEOjZBNTMxQzUyIiwidmlzaXRvcl9pZCI6IjExMzMzMTgyOTYzOTkxOTExMjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 20075aef46249609e9e2680abf615dddec9e26278c3f5c6da1ddd652ab2b7ea0 |
| hovercard-subject-tag | issue:1921789677 |
| 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/26971/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f537234ff14ac8e969f032b93a0ae2056ee9810a86af6133c49a1bb982fcd569/matplotlib/matplotlib/issues/26971 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f537234ff14ac8e969f032b93a0ae2056ee9810a86af6133c49a1bb982fcd569/matplotlib/matplotlib/issues/26971 |
| og:image:alt | Bug summary This worked up to and including Matplotlib 3.7.3 and broke in Matplotlib 3.8.0. Data files for sample code below: x.txt y.txt z.txt Code for reproduction import matplotlib matplotlib.rc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lpsinger |
| 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