<h3 dir="auto">Bug report</h3>
<p dir="auto">If one makes a scatter plot (or a line graph) having multiple points with different markers and colors, but the same label, this will result in an error in version 2.1.1 (but not 2.1.0). A small example is provided below:</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#!/usr/bin/env python
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt

color='#00ff00ff'
plt.scatter(0.0, 1.0, color=color, marker='o', label='test')
color='#00ffaaff'
plt.scatter(0.5, 0.0, color=color, marker='v', label='test')
plt.legend()
plt.savefig('foo.png')"><pre class="notranslate"><code class="notranslate">#!/usr/bin/env python
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt

color='#00ff00ff'
plt.scatter(0.0, 1.0, color=color, marker='o', label='test')
color='#00ffaaff'
plt.scatter(0.5, 0.0, color=color, marker='v', label='test')
plt.legend()
plt.savefig('foo.png')
</code></pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto">This example uses a scatter plot, but the same issue <em>can</em> arise with line plots if one uses a numpy vector as a color (e.g., <code class="notranslate">[0.0, 1.0, 0.0, 1.0]</code>). The error produced for the above example is as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;foo.py&quot;, line 11, in &lt;module&gt;
    plt.legend()
  File &quot;/home/ryan/.local/lib/python2.7/site-packages/matplotlib/pyplot.py&quot;, line 3748, in legend
    ret = gca().legend(*args, **kwargs)
  File &quot;/home/ryan/.local/lib/python2.7/site-packages/matplotlib/axes/_axes.py&quot;, line 498, in legend
    **kwargs)
  File &quot;/home/ryan/.local/lib/python2.7/site-packages/matplotlib/legend.py&quot;, line 1402, in _parse_legend_args
    handles, labels = _get_legend_handles_labels(axs, handlers)
  File &quot;/home/ryan/.local/lib/python2.7/site-packages/matplotlib/legend.py&quot;, line 1360, in _get_legend_handles_labels
    and not _in_handles(handle, label)):
  File &quot;/home/ryan/.local/lib/python2.7/site-packages/matplotlib/legend.py&quot;, line 1344, in _in_handles
    if f_h.get_facecolor() != h.get_facecolor():
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "foo.py", line 11, in &lt;module&gt;
    plt.legend()
  File "/home/ryan/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 3748, in legend
    ret = gca().legend(*args, **kwargs)
  File "/home/ryan/.local/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 498, in legend
    **kwargs)
  File "/home/ryan/.local/lib/python2.7/site-packages/matplotlib/legend.py", line 1402, in _parse_legend_args
    handles, labels = _get_legend_handles_labels(axs, handlers)
  File "/home/ryan/.local/lib/python2.7/site-packages/matplotlib/legend.py", line 1360, in _get_legend_handles_labels
    and not _in_handles(handle, label)):
  File "/home/ryan/.local/lib/python2.7/site-packages/matplotlib/legend.py", line 1344, in _in_handles
    if f_h.get_facecolor() != h.get_facecolor():
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
</code></pre></div>
<p dir="auto">At the end of the day, this ends up being because the face (and edge) colors are converted to a numpy vector, which can't be compared with <code class="notranslate">!=</code> since they have multiple elements. With the help of <code class="notranslate">git bisect</code>, I've tracked this down to <a href="https://github.com/matplotlib/matplotlib/commit/4f594f4d735ac1540d043b4843f9247111c5a6b6">this commit at the end of October</a>.</p>
<p dir="auto">Now I'll grant that this only happens if people use the same label for multiple symbols/lines, which is a bad idea...but one can't always prevent end users from doing that.</p>
<h3 dir="auto">Summary</h3>
<p dir="auto">120 seconds is an extremely long timeout when running locally and having failures. It would be good to only set the 120 seconds on CI/remote systems and have a shorter 10-20 second timeout for most contributors with reasonable CPU architectures.<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/matplotlib/matplotlib/blob/515cce40f14a4fe4eed15ddaa569052badb71229/lib/matplotlib/tests/test_backends_interactive.py#L79">matplotlib/lib/matplotlib/tests/test_backends_interactive.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 79
      in
      <a data-pjax="true" class="commit-tease-sha" href="/matplotlib/matplotlib/commit/515cce40f14a4fe4eed15ddaa569052badb71229">515cce4</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L79" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="79"></td>
          <td id="LC79" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">_test_timeout</span> <span class="pl-c1">=</span> <span class="pl-c1">120</span>  <span class="pl-c"># A reasonably safe value for slower architectures.</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Labeling good first issue because it is very contained and should likely just need some investigation into environment variables and detecting platforms we are running on.</p>
<h3 dir="auto">Proposed fix</h3>
<p dir="auto">Set the <code class="notranslate">_test_timeout</code> variable differently depending on whether we are running on CI or not.</p>