I have to change the size of the markers in my plot (making them bigger). How is it possible to change the width of errorbars too? I'm using matplotlib
. Thanks.
plot=ax.errorbar(x,y, yerr=[y1,y2], color='red', fmt='.', markersize='10', ecolor='red',capsize=4)
You can make the error bar thicker by setting the elinewidth
attribute in the call to errorbar(x,y,...) errorbar documentation. But the length of the error bar is your data: you can't change the length without changing the error that it represents.
import matplotlib.pyplot as plt
# define x,y, y1,y2 here ...
plt.figure()
plt.errorbar(x,y, yerr=[y1,y2], color='red', fmt='.', markersize='10', ecolor='red',capsize=4, elinewidth=2)
If you want to change the linewidth of the cap of the errorbar to say 2, then use the following:
(_, caps, _) = errorbar(x, y, yerr=[y1,y2], elinewidth=2)
for cap in caps:
cap.set_markeredgewidth(2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With