<h3 dir="auto">Bug summary</h3>
<p dir="auto">The function <code class="notranslate">ax.errorbar</code> raises a <code class="notranslate">StopIteration</code> error when <code class="notranslate">yerr</code> contains only <code class="notranslate">NaN</code> values.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(1, 1)
ax.errorbar([0], [0], [np.nan])"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-c1">1</span>, <span class="pl-c1">1</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">errorbar</span>([<span class="pl-c1">0</span>], [<span class="pl-c1">0</span>], [<span class="pl-s1">np</span>.<span class="pl-s1">nan</span>])</pre></div>
<h3 dir="auto">Actual outcome</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/__init__.py&quot;, line 1423, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File &quot;~.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py&quot;, line 3488, in errorbar
    yerr = _upcast_err(yerr)
  File &quot;~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py&quot;, line 3470, in _upcast_err
    isinstance(cbook._safe_first_finite(err), np.ndarray)
  File &quot;~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/cbook/__init__.py&quot;, line 1749, in _safe_first_finite
    return next(val for val in obj if safe_isfinite(val))
StopIteration"><pre class="notranslate">Traceback (most recent call last):
  File <span class="pl-s"><span class="pl-pds">"</span>&lt;stdin&gt;<span class="pl-pds">"</span></span>, line 1, <span class="pl-k">in</span> <span class="pl-k">&lt;</span>module<span class="pl-k">&gt;</span>
  File <span class="pl-s"><span class="pl-pds">"</span>~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/__init__.py<span class="pl-pds">"</span></span>, line 1423, <span class="pl-k">in</span> inner
    <span class="pl-k">return</span> func(ax, <span class="pl-k">*</span>map(sanitize_sequence, args), <span class="pl-k">**</span>kwargs)
  File <span class="pl-s"><span class="pl-pds">"</span>~.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py<span class="pl-pds">"</span></span>, line 3488, <span class="pl-k">in</span> errorbar
    yerr = _upcast_err(yerr)
  File <span class="pl-s"><span class="pl-pds">"</span>~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/axes/_axes.py<span class="pl-pds">"</span></span>, line 3470, <span class="pl-k">in</span> _upcast_err
    isinstance(cbook._safe_first_finite(err), np.ndarray)
  File <span class="pl-s"><span class="pl-pds">"</span>~/.local/share/virtualenvs/pipeline/lib/python3.9/site-packages/matplotlib/cbook/__init__.py<span class="pl-pds">"</span></span>, line 1749, <span class="pl-k">in</span> _safe_first_finite
    <span class="pl-k">return</span> next(val <span class="pl-k">for</span> <span class="pl-smi">val</span> <span class="pl-k">in</span> obj <span class="pl-k">if</span> safe_isfinite(val))
StopIteration</pre></div>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">No crash, similar to the case where only some values are NaN.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">This happens because  <code class="notranslate">_upcast_err</code> unconditionally looks for a first finite element in <code class="notranslate">xerr</code> and <code class="notranslate">yerr</code>.</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Debian</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.6.2</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">TkAgg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.9.2</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">If all values passed as colors are "bad" (<code class="notranslate">np.nan</code>), a warning is thrown from numpy about converting masked values to null. If some of the values are "bad", this does not happen.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np, matplotlib.pyplot as plt"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>, <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span></pre></div>
<p dir="auto">This does not warn:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="c = np.full(10, np.nan)
c[0] = 1.
plt.scatter(np.ones(10), np.ones(10), c=c)
plt.show()"><pre class="notranslate"><span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">full</span>(<span class="pl-c1">10</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>)
<span class="pl-s1">c</span>[<span class="pl-c1">0</span>] <span class="pl-c1">=</span> <span class="pl-c1">1.</span>
<span class="pl-s1">plt</span>.<span class="pl-en">scatter</span>(<span class="pl-s1">np</span>.<span class="pl-en">ones</span>(<span class="pl-c1">10</span>), <span class="pl-s1">np</span>.<span class="pl-en">ones</span>(<span class="pl-c1">10</span>), <span class="pl-s1">c</span><span class="pl-c1">=</span><span class="pl-s1">c</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto">This does:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="plt.scatter(np.ones(10), np.ones(10), c=np.full(10, np.nan))
plt.show()"><pre class="notranslate"><span class="pl-s1">plt</span>.<span class="pl-en">scatter</span>(<span class="pl-s1">np</span>.<span class="pl-en">ones</span>(<span class="pl-c1">10</span>), <span class="pl-s1">np</span>.<span class="pl-en">ones</span>(<span class="pl-c1">10</span>), <span class="pl-s1">c</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-en">full</span>(<span class="pl-c1">10</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>))
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;__array_function__ internals&gt;:5: UserWarning: Warning: converting a masked element to nan.
/usr/local/lib/python3.8/site-packages/numpy/core/_asarray.py:85: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order)"><pre class="notranslate">&lt;__array_function__ internals&gt;:5: UserWarning: Warning: converting a masked element to nan.
/usr/local/lib/python3.8/site-packages/numpy/core/_asarray.py:85: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order)</pre></div>
<p dir="auto">This is difficult to hide since since the warning is not thrown when the figure is being constructed, but when it is shown. Here's a full traceback to show this:</p>
<details>
<summary> Full traceback </summary>
<div class="highlight highlight-text-python-traceback notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/pyplot.py&quot;, line 337, in show
    return _backend_mod.show(*args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/backend_bases.py&quot;, line 3544, in show
    cls.mainloop()
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py&quot;, line 171, in mainloop
    _macosx.show()
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py&quot;, line 61, in _draw
    self.figure.draw(renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/figure.py&quot;, line 1863, in draw
    mimage._draw_list_compositing_images(
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/image.py&quot;, line 131, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py&quot;, line 411, in wrapper
    return func(*inner_args, **inner_kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/axes/_base.py&quot;, line 2748, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/image.py&quot;, line 131, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/collections.py&quot;, line 931, in draw
    Collection.draw(self, renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/collections.py&quot;, line 346, in draw
    self.update_scalarmappable()
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/collections.py&quot;, line 855, in update_scalarmappable
    self._facecolors = self.to_rgba(self._A, self._alpha)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/cm.py&quot;, line 332, in to_rgba
    x = self.norm(x)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/colors.py&quot;, line 1048, in __call__
    (vmin,), _ = self.process_value(self.vmin)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/colors.py&quot;, line 1012, in process_value
    dtype = np.min_scalar_type(value)
  File &quot;&lt;__array_function__ internals&gt;&quot;, line 5, in min_scalar_type
  File &quot;/usr/local/lib/python3.8/site-packages/numpy/ma/core.py&quot;, line 4331, in __float__
    warnings.warn(&quot;Warning: converting a masked element to nan.&quot;, stacklevel=2)
  File &quot;/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/warnings.py&quot;, line 109, in _showwarnmsg
    sw(msg.message, msg.category, msg.filename, msg.lineno,
  File &quot;&lt;stdin&gt;&quot;, line 3, in warn_with_traceback
&lt;__array_function__ internals&gt;:5: UserWarning: Warning: converting a masked element to nan.
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/pyplot.py&quot;, line 337, in show
    return _backend_mod.show(*args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/backend_bases.py&quot;, line 3544, in show
    cls.mainloop()
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py&quot;, line 171, in mainloop
    _macosx.show()
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py&quot;, line 61, in _draw
    self.figure.draw(renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/figure.py&quot;, line 1863, in draw
    mimage._draw_list_compositing_images(
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/image.py&quot;, line 131, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py&quot;, line 411, in wrapper
    return func(*inner_args, **inner_kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/axes/_base.py&quot;, line 2748, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/image.py&quot;, line 131, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/collections.py&quot;, line 931, in draw
    Collection.draw(self, renderer)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/artist.py&quot;, line 41, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/collections.py&quot;, line 346, in draw
    self.update_scalarmappable()
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/collections.py&quot;, line 855, in update_scalarmappable
    self._facecolors = self.to_rgba(self._A, self._alpha)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/cm.py&quot;, line 332, in to_rgba
    x = self.norm(x)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/colors.py&quot;, line 1048, in __call__
    (vmin,), _ = self.process_value(self.vmin)
  File &quot;/usr/local/lib/python3.8/site-packages/matplotlib/colors.py&quot;, line 1019, in process_value
    data = np.asarray(value)
  File &quot;/usr/local/lib/python3.8/site-packages/numpy/core/_asarray.py&quot;, line 85, in asarray
    return array(a, dtype, copy=False, order=order)
  File &quot;/usr/local/lib/python3.8/site-packages/numpy/ma/core.py&quot;, line 4331, in __float__
    warnings.warn(&quot;Warning: converting a masked element to nan.&quot;, stacklevel=2)
  File &quot;/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/warnings.py&quot;, line 109, in _showwarnmsg
    sw(msg.message, msg.category, msg.filename, msg.lineno,
  File &quot;&lt;stdin&gt;&quot;, line 3, in warn_with_traceback
/usr/local/lib/python3.8/site-packages/numpy/core/_asarray.py:85: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order)"><pre class="notranslate">  File <span class="pl-s">"&lt;stdin&gt;"</span>, line <span class="pl-c1">1</span>, in <span class="pl-en">&lt;module&gt;</span>
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/pyplot.py"</span>, line <span class="pl-c1">337</span>, in <span class="pl-en">show</span>
    <span class="pl-k">return</span> _backend_mod.show(<span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/backend_bases.py"</span>, line <span class="pl-c1">3544</span>, in <span class="pl-en">show</span>
    <span class="pl-c1">cls</span>.mainloop()
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py"</span>, line <span class="pl-c1">171</span>, in <span class="pl-en">mainloop</span>
    _macosx.show()
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py"</span>, line <span class="pl-c1">61</span>, in <span class="pl-en">_draw</span>
    <span class="pl-c1">self</span>.figure.draw(renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/figure.py"</span>, line <span class="pl-c1">1863</span>, in <span class="pl-en">draw</span>
    mimage._draw_list_compositing_images(
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/image.py"</span>, line <span class="pl-c1">131</span>, in <span class="pl-en">_draw_list_compositing_images</span>
    a.draw(renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py"</span>, line <span class="pl-c1">411</span>, in <span class="pl-en">wrapper</span>
    <span class="pl-k">return</span> func(<span class="pl-k">*</span>inner_args, <span class="pl-k">**</span>inner_kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/axes/_base.py"</span>, line <span class="pl-c1">2748</span>, in <span class="pl-en">draw</span>
    mimage._draw_list_compositing_images(renderer, <span class="pl-c1">self</span>, artists)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/image.py"</span>, line <span class="pl-c1">131</span>, in <span class="pl-en">_draw_list_compositing_images</span>
    a.draw(renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/collections.py"</span>, line <span class="pl-c1">931</span>, in <span class="pl-en">draw</span>
    Collection.draw(<span class="pl-c1">self</span>, renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/collections.py"</span>, line <span class="pl-c1">346</span>, in <span class="pl-en">draw</span>
    <span class="pl-c1">self</span>.update_scalarmappable()
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/collections.py"</span>, line <span class="pl-c1">855</span>, in <span class="pl-en">update_scalarmappable</span>
    <span class="pl-c1">self</span>._facecolors <span class="pl-k">=</span> <span class="pl-c1">self</span>.to_rgba(<span class="pl-c1">self</span>._A, <span class="pl-c1">self</span>._alpha)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/cm.py"</span>, line <span class="pl-c1">332</span>, in <span class="pl-en">to_rgba</span>
    x <span class="pl-k">=</span> <span class="pl-c1">self</span>.norm(x)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/colors.py"</span>, line <span class="pl-c1">1048</span>, in <span class="pl-en">__call__</span>
    (vmin,), _ <span class="pl-k">=</span> <span class="pl-c1">self</span>.process_value(<span class="pl-c1">self</span>.vmin)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/colors.py"</span>, line <span class="pl-c1">1012</span>, in <span class="pl-en">process_value</span>
    dtype <span class="pl-k">=</span> np.min_scalar_type(value)
  File <span class="pl-s">"&lt;__array_function__ internals&gt;"</span>, line <span class="pl-c1">5</span>, in <span class="pl-en">min_scalar_type</span>
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/numpy/ma/core.py"</span>, line <span class="pl-c1">4331</span>, in <span class="pl-en">__float__</span>
    warnings.warn(<span class="pl-s"><span class="pl-pds">"</span>Warning: converting a masked element to nan.<span class="pl-pds">"</span></span>, <span class="pl-v">stacklevel</span><span class="pl-k">=</span><span class="pl-c1">2</span>)
  File <span class="pl-s">"/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/warnings.py"</span>, line <span class="pl-c1">109</span>, in <span class="pl-en">_showwarnmsg</span>
    sw(msg.message, msg.category, msg.filename, msg.lineno,
  File <span class="pl-s">"&lt;stdin&gt;"</span>, line <span class="pl-c1">3</span>, in <span class="pl-en">warn_with_traceback</span>
&lt;__array_function__ internals&gt;:5: UserWarning: Warning: converting a masked element to nan.
  File <span class="pl-s">"&lt;stdin&gt;"</span>, line <span class="pl-c1">1</span>, in <span class="pl-en">&lt;module&gt;</span>
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/pyplot.py"</span>, line <span class="pl-c1">337</span>, in <span class="pl-en">show</span>
    <span class="pl-k">return</span> _backend_mod.show(<span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/backend_bases.py"</span>, line <span class="pl-c1">3544</span>, in <span class="pl-en">show</span>
    <span class="pl-c1">cls</span>.mainloop()
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py"</span>, line <span class="pl-c1">171</span>, in <span class="pl-en">mainloop</span>
    _macosx.show()
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py"</span>, line <span class="pl-c1">61</span>, in <span class="pl-en">_draw</span>
    <span class="pl-c1">self</span>.figure.draw(renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/figure.py"</span>, line <span class="pl-c1">1863</span>, in <span class="pl-en">draw</span>
    mimage._draw_list_compositing_images(
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/image.py"</span>, line <span class="pl-c1">131</span>, in <span class="pl-en">_draw_list_compositing_images</span>
    a.draw(renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py"</span>, line <span class="pl-c1">411</span>, in <span class="pl-en">wrapper</span>
    <span class="pl-k">return</span> func(<span class="pl-k">*</span>inner_args, <span class="pl-k">**</span>inner_kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/axes/_base.py"</span>, line <span class="pl-c1">2748</span>, in <span class="pl-en">draw</span>
    mimage._draw_list_compositing_images(renderer, <span class="pl-c1">self</span>, artists)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/image.py"</span>, line <span class="pl-c1">131</span>, in <span class="pl-en">_draw_list_compositing_images</span>
    a.draw(renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/collections.py"</span>, line <span class="pl-c1">931</span>, in <span class="pl-en">draw</span>
    Collection.draw(<span class="pl-c1">self</span>, renderer)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/artist.py"</span>, line <span class="pl-c1">41</span>, in <span class="pl-en">draw_wrapper</span>
    <span class="pl-k">return</span> draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/collections.py"</span>, line <span class="pl-c1">346</span>, in <span class="pl-en">draw</span>
    <span class="pl-c1">self</span>.update_scalarmappable()
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/collections.py"</span>, line <span class="pl-c1">855</span>, in <span class="pl-en">update_scalarmappable</span>
    <span class="pl-c1">self</span>._facecolors <span class="pl-k">=</span> <span class="pl-c1">self</span>.to_rgba(<span class="pl-c1">self</span>._A, <span class="pl-c1">self</span>._alpha)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/cm.py"</span>, line <span class="pl-c1">332</span>, in <span class="pl-en">to_rgba</span>
    x <span class="pl-k">=</span> <span class="pl-c1">self</span>.norm(x)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/colors.py"</span>, line <span class="pl-c1">1048</span>, in <span class="pl-en">__call__</span>
    (vmin,), _ <span class="pl-k">=</span> <span class="pl-c1">self</span>.process_value(<span class="pl-c1">self</span>.vmin)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/matplotlib/colors.py"</span>, line <span class="pl-c1">1019</span>, in <span class="pl-en">process_value</span>
    data <span class="pl-k">=</span> np.asarray(value)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/numpy/core/_asarray.py"</span>, line <span class="pl-c1">85</span>, in <span class="pl-en">asarray</span>
    <span class="pl-k">return</span> array(a, dtype, <span class="pl-v">copy</span><span class="pl-k">=</span><span class="pl-c1">False</span>, <span class="pl-v">order</span><span class="pl-k">=</span>order)
  File <span class="pl-s">"/usr/local/lib/python3.8/site-packages/numpy/ma/core.py"</span>, line <span class="pl-c1">4331</span>, in <span class="pl-en">__float__</span>
    warnings.warn(<span class="pl-s"><span class="pl-pds">"</span>Warning: converting a masked element to nan.<span class="pl-pds">"</span></span>, <span class="pl-v">stacklevel</span><span class="pl-k">=</span><span class="pl-c1">2</span>)
  File <span class="pl-s">"/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/warnings.py"</span>, line <span class="pl-c1">109</span>, in <span class="pl-en">_showwarnmsg</span>
    sw(msg.message, msg.category, msg.filename, msg.lineno,
  File <span class="pl-s">"&lt;stdin&gt;"</span>, line <span class="pl-c1">3</span>, in <span class="pl-en">warn_with_traceback</span>
/usr/local/lib/python3.8/site-packages/numpy/core/_asarray.py:85: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order)</pre></div>
</details>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">I wouldn't expect the second to warn if the first doesn't.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: macOS</li>
<li>Matplotlib version: 3.3.1</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): MacOSX and module://ipykernel.pylab.backend_inline</li>
<li>Python version: 3.8.5</li>
<li>Jupyter version (if applicable): Replicates in python repl, but also was happening in ipython and jupyter lab</li>
<li>Other libraries:</li>
</ul>
<p dir="auto">Installed with pip</p>