sigma = [1, 3, 2, 5]
_, caps, _ = plt.errorbar(distance, energy, sigma, capsize=20, elinewidth=3)
for cap in caps:
    cap.set_color('red')
cap.set_markeredgewidth(10)
plt.show
How to set the line width of error bar caps, in matplotlib?