| 1 | diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py |
| 2 | --- a/lib/matplotlib/axes/_axes.py |
| 3 | +++ b/lib/matplotlib/axes/_axes.py |
| 4 | @@ -2182,11 +2182,19 @@ def _convert_dx(dx, x0, xconv, convert): |
| 5 | x0 = cbook._safe_first_finite(x0) |
| 6 | except (TypeError, IndexError, KeyError): |
| 7 | pass |
| 8 | + except StopIteration: |
| 9 | + # this means we found no finite element, fall back to first |
| 10 | + # element unconditionally |
| 11 | + x0 = cbook.safe_first_element(x0) |
| 12 | |
| 13 | try: |
| 14 | x = cbook._safe_first_finite(xconv) |
| 15 | except (TypeError, IndexError, KeyError): |
| 16 | x = xconv |
| 17 | + except StopIteration: |
| 18 | + # this means we found no finite element, fall back to first |
| 19 | + # element unconditionally |
| 20 | + x = cbook.safe_first_element(xconv) |
| 21 | |
| 22 | delist = False |
| 23 | if not np.iterable(dx): |