Empty circles with errorbars

Viewed 1036

How can I make a python plot with empty circles and error bars? I see I can use facecolors='none' for a scatter plot, but it is not working for errorbar plot. I also found mfc='none' which makes the circles empty, but the error bars are still visible inside the circles. How can I make it such that the circles are completely empty, and the error bars come out only from outside of the circles (the errorbars are bigger than the size of the data points)?Thank you!

1 Answers

One option is to plot with mfc the same color with the background color, e.g. mfc='w':

y = [1,2,3,4]
yerr=[.1,.2,.3,.4]

plt.figure(figsize=(10,6))
plt.errorbar(x=y,y=y, yerr=yerr, ms=30, marker='o', mfc='w')

Output:

enter image description here

However, there is a risk as you can see above, when the marker size is larger than the error, you don't get to see the error bars.

Related