# matplotlib__matplotlib-24149
# Loki Mode Multi-Agent Patch
# Attempts: 1

--- a/lib/matplotlib/axes/_axes.py
+++ b/lib/matplotlib/axes/_axes.py
@@ -2179,10 +2179,10 @@ class Axes(_AxesBase):
                 # removes the units from unit packages like `pint` that
                 # wrap numpy arrays.
                 try:
                     x0 = cbook._safe_first_finite(x0)
-                except (TypeError, IndexError, KeyError):
+                except (TypeError, IndexError, KeyError, StopIteration):
                     pass
 
             try:
                 x = cbook._safe_first_finite(x)
-            except (TypeError, IndexError, KeyError):
+            except (TypeError, IndexError, KeyError, StopIteration):
                 x = cbook.safe_first_element(x)