Matplotlib Error Bars
<p>If I run this code:</p>

<pre><code>plt.scatter(n, y, marker ='^', s = 30, color = 'k')
plt.errorbar(n, y, yerr=yerror)
plt.ylim(ymin = 5, ymax = 20)
</code></pre>

<p>The resulting graph has a red line between the scatterplot. How do I prevent this line from appearing? Additionally, how might I add caps to the error bars? </p>

<p>I have tried</p>

<pre><code>(_, caps, _) = plt.errorbar(n,y, yerr=yerror, capsize=5, elinewidth=3)

for cap in caps:
    cap.set_color('k')
    cap.set_markeredgewidth(3) 
</code></pre>

<p>and</p>

<pre><code>plt.errorbar(n, y, yerr = yerror, ecolor = 'k', capsize = 5)
</code></pre>

<p>But neither has worked. There is clearly something fundamental I am missing about errorbars.</p>

<p><a href="https://i.stack.imgur.com/lJDvX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lJDvX.png" alt="enter image description here"></a></p>