<p dir="auto">Somewhere between all the convert things to OO and restructure gallery PRs, the <a href="https://matplotlib.org/devdocs/gallery/index.html#pyplot" rel="nofollow">pyplot</a> section of the gallery now has very little pyplot content:</p>
<h3 dir="auto">PyPlot</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/pyplot_formatstr.html#sphx-glr-gallery-pyplots-pyplot-formatstr-py" rel="nofollow">plot() format string</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/pyplot_mathtext.html#sphx-glr-gallery-pyplots-pyplot-mathtext-py" rel="nofollow">Pyplot mathtext</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/pyplot_simple.html#sphx-glr-gallery-pyplots-pyplot-simple-py" rel="nofollow">Pyplot simple</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/pyplot_text.html#sphx-glr-gallery-pyplots-pyplot-text-py" rel="nofollow">Pyplot text</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/pyplot_three.html#sphx-glr-gallery-pyplots-pyplot-three-py" rel="nofollow">Pyplot three</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/pyplot_two_subplots.html#sphx-glr-gallery-pyplots-pyplot-two-subplots-py" rel="nofollow">Pyplot two subplots</a></li>
</ul>
<h3 dir="auto">OO</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/align_ylabels.html#sphx-glr-gallery-pyplots-align-ylabels-py" rel="nofollow">Align y-labels</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/annotate_transform.html#sphx-glr-gallery-pyplots-annotate-transform-py" rel="nofollow">Annotate Transform</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/annotation_basic.html#sphx-glr-gallery-pyplots-annotation-basic-py" rel="nofollow">Annotate a plot</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/annotation_polar.html#sphx-glr-gallery-pyplots-annotation-polar-py" rel="nofollow">Annotate Polar</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/auto_subplots_adjust.html#sphx-glr-gallery-pyplots-auto-subplots-adjust-py" rel="nofollow">Auto Subplots Adjust</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/boxplot_demo_pyplot.html#sphx-glr-gallery-pyplots-boxplot-demo-pyplot-py" rel="nofollow">Boxplot Demo</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/dollar_ticks.html#sphx-glr-gallery-pyplots-dollar-ticks-py" rel="nofollow">Dollar Ticks</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/fig_axes_customize_simple.html#sphx-glr-gallery-pyplots-fig-axes-customize-simple-py" rel="nofollow">Fig Axes Customize Simple</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/fig_axes_labels_simple.html#sphx-glr-gallery-pyplots-fig-axes-labels-simple-py" rel="nofollow">Simple Axes labels</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/fig_x.html#sphx-glr-gallery-pyplots-fig-x-py" rel="nofollow">Adding lines to figures</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/text_commands.html#sphx-glr-gallery-pyplots-text-commands-py" rel="nofollow">Text Commands</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <a href="https://matplotlib.org/devdocs/gallery/pyplots/text_layout.html#sphx-glr-gallery-pyplots-text-layout-py" rel="nofollow">Text Layout</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> what's new examples in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="537201751" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/15920" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/15920/hovercard" href="https://github.com/matplotlib/matplotlib/issues/15920">#15920</a></li>
</ul>
<p dir="auto">I think there should be a standalone pyplot only gallery page, but think for this PR a potential resolution would be to sort the OO examples into the correct sections (possibly combining them with existing content) or altogether remove them if they're not adding any information.</p>
<p dir="auto">xref: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="500921047" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/15355" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/15355/hovercard" href="https://github.com/matplotlib/matplotlib/issues/15355">#15355</a> because I think this contributes to some of the confusion discussed there.</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">When by mistake the same label is used with fill_between with difference facecolor attributes, matplotlib crash with a very unhelpful message.</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 matplotlib.pylab as plt
f, ax = plt.subplots(1, 1, figsize=(1, 4))
p = ax.semilogy(range(10), range(10), label=&quot;label1&quot;)
p = ax.semilogy(range(10), range(10), label=&quot;label2&quot;)
ax.fill_between(range(1,11), 0, 10, 
                     facecolor=p[-1].get_color(), 
                     edgecolor=None, alpha=0.25, label=&quot;label4&quot;)
p = ax.semilogy(range(10), range(10), label=&quot;label3&quot;)
ax.fill_between(range(1,11), 0, 10, 
                     facecolor=p[-1].get_color(), 
                     edgecolor=None, alpha=0.25, label=&quot;label4&quot;)

ax.legend(loc=&quot;lower center&quot;)  "><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pylab</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-s1">f</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">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>, <span class="pl-c1">4</span>))
<span class="pl-s1">p</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">semilogy</span>(<span class="pl-en">range</span>(<span class="pl-c1">10</span>), <span class="pl-en">range</span>(<span class="pl-c1">10</span>), <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"label1"</span>)
<span class="pl-s1">p</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">semilogy</span>(<span class="pl-en">range</span>(<span class="pl-c1">10</span>), <span class="pl-en">range</span>(<span class="pl-c1">10</span>), <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"label2"</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">fill_between</span>(<span class="pl-en">range</span>(<span class="pl-c1">1</span>,<span class="pl-c1">11</span>), <span class="pl-c1">0</span>, <span class="pl-c1">10</span>, 
                     <span class="pl-s1">facecolor</span><span class="pl-c1">=</span><span class="pl-s1">p</span>[<span class="pl-c1">-</span><span class="pl-c1">1</span>].<span class="pl-en">get_color</span>(), 
                     <span class="pl-s1">edgecolor</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">0.25</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"label4"</span>)
<span class="pl-s1">p</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">semilogy</span>(<span class="pl-en">range</span>(<span class="pl-c1">10</span>), <span class="pl-en">range</span>(<span class="pl-c1">10</span>), <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"label3"</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">fill_between</span>(<span class="pl-en">range</span>(<span class="pl-c1">1</span>,<span class="pl-c1">11</span>), <span class="pl-c1">0</span>, <span class="pl-c1">10</span>, 
                     <span class="pl-s1">facecolor</span><span class="pl-c1">=</span><span class="pl-s1">p</span>[<span class="pl-c1">-</span><span class="pl-c1">1</span>].<span class="pl-en">get_color</span>(), 
                     <span class="pl-s1">edgecolor</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">alpha</span><span class="pl-c1">=</span><span class="pl-c1">0.25</span>, <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">"label4"</span>)

<span class="pl-s1">ax</span>.<span class="pl-en">legend</span>(<span class="pl-s1">loc</span><span class="pl-c1">=</span><span class="pl-s">"lower center"</span>)  </pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-1-fca22924ade8&gt; in &lt;module&gt;()
     11                      edgecolor=None, alpha=0.25, label=&quot;label4&quot;)
     12 
---&gt; 13 ax.legend(loc=&quot;lower center&quot;)

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/axes/_axes.py in legend(self, *args, **kwargs)
    495                 [self],
    496                 *args,
--&gt; 497                 **kwargs)
    498         if len(extra_args):
    499             raise TypeError('legend only accepts two non-keyword arguments')

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/legend.py in _parse_legend_args(axs, *args, **kwargs)
   1401     # No arguments - automatically detect labels and handles.
   1402     elif len(args) == 0:
-&gt; 1403         handles, labels = _get_legend_handles_labels(axs, handlers)
   1404         if not handles:
   1405             log.warning('No handles with labels found to put in legend.')

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/legend.py in _get_legend_handles_labels(axs, legend_handler_map)
   1359         if (label
   1360                 and not label.startswith('_')
-&gt; 1361                 and not _in_handles(handle, label)):
   1362             handles.append(handle)
   1363             labels.append(label)

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/legend.py in _in_handles(h, l)
   1343             try:
   1344                 print(type(f_h.get_facecolor()), f_h.get_facecolor(), h.get_facecolor())
-&gt; 1345                 if f_h.get_facecolor() != h.get_facecolor():
   1346                     continue
   1347             except AttributeError:

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">---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-1-fca22924ade8&gt; in &lt;module&gt;()
     11                      edgecolor=None, alpha=0.25, label="label4")
     12 
---&gt; 13 ax.legend(loc="lower center")

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/axes/_axes.py in legend(self, *args, **kwargs)
    495                 [self],
    496                 *args,
--&gt; 497                 **kwargs)
    498         if len(extra_args):
    499             raise TypeError('legend only accepts two non-keyword arguments')

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/legend.py in _parse_legend_args(axs, *args, **kwargs)
   1401     # No arguments - automatically detect labels and handles.
   1402     elif len(args) == 0:
-&gt; 1403         handles, labels = _get_legend_handles_labels(axs, handlers)
   1404         if not handles:
   1405             log.warning('No handles with labels found to put in legend.')

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/legend.py in _get_legend_handles_labels(axs, legend_handler_map)
   1359         if (label
   1360                 and not label.startswith('_')
-&gt; 1361                 and not _in_handles(handle, label)):
   1362             handles.append(handle)
   1363             labels.append(label)

/home/oreilly/python_venv/venv-3.4/lib/python3.5/site-packages/matplotlib/legend.py in _in_handles(h, l)
   1343             try:
   1344                 print(type(f_h.get_facecolor()), f_h.get_facecolor(), h.get_facecolor())
-&gt; 1345                 if f_h.get_facecolor() != h.get_facecolor():
   1346                     continue
   1347             except AttributeError:

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"><strong>Expected outcome</strong></p>
<p dir="auto">Either two entries in the legend with the same label, but different colors (if you allow to have two time a same label) or a helpful error message when calling the plotting function reusing an existing label.</p>
<p dir="auto">If it might help you speed up your debugging, when executing we get:<br>
f_h.get_facecolor() == [[1.         0.49803922 0.05490196 0.25      ]]<br>
h.get_facecolor() == [[0.17254902 0.62745098 0.17254902 0.25      ]]<br>
type(f_h.get_facecolor() ) == &lt;class 'numpy.ndarray'&gt;<br>
So, the error comes from the fact the types of f_h.get_facecolor() becomes a numpy.array in this condition and that, as opposed to list for example, you cannot have "if array1 == array2 : " without the use of the "any()" or "all()", as mentioned by the error message.</p>

<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Ubuntu 16.04 LTS</li>
<li>Matplotlib version: 1.14.0'</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): module://ipykernel.pylab.backend_inline</li>
<li>Python version: '3.5.2 (default, Nov 23 2017, 16:37:01) \n[GCC 5.4.0 20160609]'</li>
<li>Jupyter version (if applicable): 4.4.0</li>
<li>Other libraries:</li>
</ul>