Pyplot errorbar keeps connecting my points with lines?
<p>I am having trouble getting these lines between my data points to go away! It seems to be whenever I try to add error bars it does this. If you look at the graphs, the first is without the errorbar line, and the second is with it. Is this a usual side effect of pyplot errorbar? Does anyone know why it does this, or how to make it go away? </p>

<pre><code>plt.figure()
plt.scatter(x, y, label = 'blah')
plt.errorbar(x, y, yerr = None, xerr = x_err) 
plt.plot(x, f) #this is a line of best fit
</code></pre>

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

<p>You can set the line style (<code>ls</code>) to <code>none</code>:</p>

<pre><code>import numpy as np
import matplotlib.pylab as plt

x = np.arange(10)
y = np.arange(10)
yerr = np.random.random(10)
xerr = np.random.random(10)

plt.figure()
plt.subplot(121)
plt.scatter(x, y, label = 'blah')
plt.errorbar(x, y, yerr = None, xerr = xerr) 

plt.subplot(122)
plt.scatter(x, y, label = 'blah')
plt.errorbar(x, y, yerr = None, xerr = xerr, ls='none') 
</code></pre>

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

python matplotlib errorbar