Reputation: 87
import matplotlib.pyplot as plt
plt.scatter(x, y, marker='*')
plt.xscale('linear')
plt.yscale('linear')
plt.errorbar(x, y, yerr=e, ecolour='k')
plt.show()
where x and y are numpy arrays of data points and e is also a numpy array of corresponding error intervals.
When I run this code it gives my a graph with the black (specified by ecolour='k') error lines and default blue connecting lines between the data points, how do I remove these blue connecting lines?
Or, alternatively, how do I specify the colour of the connecting lines separately? 'linespec' doesn't work.
Upvotes: 2
Views: 9098
Reputation: 87
plt.errorbar(x, y, yerr=e, ecolor='k', linestyle='')
UPDATE: just give a linestyle argument and set it to either None, '' or ' ' and it doesn't draw the connecting lines but keeps the error bars.
also correction to my post, it should be color not colour.
Upvotes: 3