Matplotlib Errorbar Caps Missing
What worked for me was adding this (as per: How to set the line width of error bar caps, in matplotlib):
(_, caps, _) = plt.errorbar(x,y, yerr=err, capsize=20, elinewidth=3)
for cap in caps:
cap.set_color('red')
cap.set_markeredgewidth(10)
Slight simplification of astromax's answer:
plt.errorbar(x,y, yerr=err, capsize=20, elinewidth=3, markeredgewidth=10)
It seems that somehow markeredgewidth is defaulting to 0 sometimes.
It has to do with the rcParams in matplotlib. To solve it, add the following lines at the beginning of your script:
import matplotlib
matplotlib.rcParams.update({'errorbar.capsize': 2})
It also works with plt.bar()
.