<p dir="auto">I encountered an issue of the legend in matplotlib.pyplot.errorbar when I plot a pandas' DataFrame object.  A minimum example based on the release note of v1.5 is the following.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas
import numpy as np
import matplotlib.pyplot as plt

df = pandas.DataFrame({&quot;var1&quot;:[1,2,3,4,5,6], &quot;var2&quot;:[1,2,3,4,5,6]})"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</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-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-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pandas</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">"var1"</span>:[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>,<span class="pl-c1">4</span>,<span class="pl-c1">5</span>,<span class="pl-c1">6</span>], <span class="pl-s">"var2"</span>:[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>,<span class="pl-c1">4</span>,<span class="pl-c1">5</span>,<span class="pl-c1">6</span>]})</pre></div>
<p dir="auto">Here is the same as one in the release note, but with a legend.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="plt.plot(df[&quot;var1&quot;], df[&quot;var2&quot;], label='test')
plt.legend()"><pre class="notranslate"><span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">df</span>[<span class="pl-s">"var1"</span>], <span class="pl-s1">df</span>[<span class="pl-s">"var2"</span>], <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">'test'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">legend</span>()</pre></div>
<p dir="auto">The output is the following.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/90394/11405337/5a201cc4-93a7-11e5-92ea-d747f4e37074.png"><img src="https://cloud.githubusercontent.com/assets/90394/11405337/5a201cc4-93a7-11e5-92ea-d747f4e37074.png" alt="test_pandas_plot" style="max-width: 100%;"></a></p>
<p dir="auto">The following code makes the issue.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="plt.errorbar(df[&quot;var1&quot;], df[&quot;var2&quot;], label='test')
plt.legend()"><pre class="notranslate"><span class="pl-s1">plt</span>.<span class="pl-en">errorbar</span>(<span class="pl-s1">df</span>[<span class="pl-s">"var1"</span>], <span class="pl-s1">df</span>[<span class="pl-s">"var2"</span>], <span class="pl-s1">label</span><span class="pl-c1">=</span><span class="pl-s">'test'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">legend</span>()</pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/90394/11405364/843b58de-93a7-11e5-926f-59b52cddbbbb.png"><img src="https://cloud.githubusercontent.com/assets/90394/11405364/843b58de-93a7-11e5-926f-59b52cddbbbb.png" alt="test_pandas_err" style="max-width: 100%;"></a></p>
<p dir="auto">As you can see, the 'var2' key is not overridden by the <code class="notranslate">label='test'</code> and there are two lines instead of one in the legend.</p>
<p dir="auto">A quick workaround is to convert the y values to numpy array with <code class="notranslate">np.array(df["var2"])</code> when plotting.</p>
<p dir="auto">I'm using Python 2.7.8 installed via homebrew on OS X 10.10.5, matplotlib 1.5.0, and pandas 0.17.0.</p>
<p dir="auto">When I make an errorbar plot from pandas Series, the names of the series appear twice in the legend. Once as a solid line, and once as a solid line with error bars. Explicitly setting the label argument replaces the label text for the solid line with errorbars.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.DataFrame(data = np.random.rand(10,3),index=pd.Series(np.arange(0,20,2),name=&quot;number&quot;),columns=&quot;A B C&quot;.split())
plt.errorbar(df.index,df.A,df.B)
plt.legend()"><pre class="notranslate"><code class="notranslate">%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.DataFrame(data = np.random.rand(10,3),index=pd.Series(np.arange(0,20,2),name="number"),columns="A B C".split())
plt.errorbar(df.index,df.A,df.B)
plt.legend()
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/6113878/10935717/2fc98b4c-82e8-11e5-8750-683fbc66efdc.png"><img src="https://cloud.githubusercontent.com/assets/6113878/10935717/2fc98b4c-82e8-11e5-8750-683fbc66efdc.png" alt="image" style="max-width: 100%;"></a></p>