Title: [Bug]: ax.errorbar raises for all-nan data on matplotlib 3.6.2 · Issue #24818 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: ax.errorbar raises for all-nan data on matplotlib 3.6.2 · Issue #24818 · matplotlib/matplotlib
X Title: [Bug]: ax.errorbar raises for all-nan data on matplotlib 3.6.2 · Issue #24818 · matplotlib/matplotlib
Description: Bug summary The function ax.errorbar raises a StopIteration error when yerr contains only NaN values. Code for reproduction import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(1, 1) ax.errorbar([0], [0], [np.nan]) A...
Open Graph Description: Bug summary The function ax.errorbar raises a StopIteration error when yerr contains only NaN values. Code for reproduction import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots...
X Description: Bug summary The function ax.errorbar raises a StopIteration error when yerr contains only NaN values. Code for reproduction import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24818
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: ax.errorbar raises for all-nan data on matplotlib 3.6.2","articleBody":"### Bug summary\r\n\r\nThe function `ax.errorbar` raises a `StopIteration` error when `yerr` contains only `NaN` values.\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nfig, ax = plt.subplots(1, 1)\r\nax.errorbar([0], [0], [np.nan])\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n```shell\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/__init__.py\", line 1423, in inner\r\n return func(ax, *map(sanitize_sequence, args), **kwargs)\r\n File \"~.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py\", line 3488, in errorbar\r\n yerr = _upcast_err(yerr)\r\n File \"~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py\", line 3470, in _upcast_err\r\n isinstance(cbook._safe_first_finite(err), np.ndarray)\r\n File \"~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/cbook/__init__.py\", line 1749, in _safe_first_finite\r\n return next(val for val in obj if safe_isfinite(val))\r\nStopIteration\r\n```\r\n\r\n### Expected outcome\r\n\r\nNo crash, similar to the case where only some values are NaN.\r\n\r\n### Additional information\r\n\r\nThis happens because `_upcast_err` unconditionally looks for a first finite element in `xerr` and `yerr`.\r\n\r\n### Operating system\r\n\r\nDebian\r\n\r\n### Matplotlib Version\r\n\r\n3.6.2\r\n\r\n### Matplotlib Backend\r\n\r\nTkAgg\r\n\r\n### Python version\r\n\r\n3.9.2\r\n\r\n### Jupyter version\r\n\r\n_No response_\r\n\r\n### Installation\r\n\r\npip","author":{"url":"https://github.com/MaximeLucasSky","@type":"Person","name":"MaximeLucasSky"},"datePublished":"2022-12-26T13:59:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/24818/matplotlib/issues/24818"}
| 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:8bf7ce5c-3517-af81-12b6-3ac64a2f1f12 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AACC:29BECE:7B4A0F:A1AA3B:6A517E6E |
| html-safe-nonce | 858aad55f2a949aab180a249ee69f49960d7ba06ad9afe9315d0e3c4e48a9efd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUNDOjI5QkVDRTo3QjRBMEY6QTFBQTNCOjZBNTE3RTZFIiwidmlzaXRvcl9pZCI6IjcwNTEwNDQ2NDk0MDQ2NTc3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ef201d5d7656c03af1c64a722b2ba26830dc14d9acbfc26038f5040f38fc03e7 |
| hovercard-subject-tag | issue:1510979433 |
| 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/24818/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1cfe0b7646a33fa13935ee7231581437ce335f52cc39fc8ed64884249bc4c230/matplotlib/matplotlib/issues/24818 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1cfe0b7646a33fa13935ee7231581437ce335f52cc39fc8ed64884249bc4c230/matplotlib/matplotlib/issues/24818 |
| og:image:alt | Bug summary The function ax.errorbar raises a StopIteration error when yerr contains only NaN values. Code for reproduction import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MaximeLucasSky |
| 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 | d01c62704ef24df49056c63892a149b775e1353d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width