How to change the marker symbol of errorbar limits in matplotlib?

≡放荡痞女 提交于 2021-01-28 05:13:59

问题


just a quick question, where I couldn't find anything helpful in the plt.errorbar documentation

I want to plot values with error bars:

import matplotlib.pyplot as plt
plt.errorbar(1, 0.25, yerr=0.1, uplims=True, lolims=True, fmt='o')
plt.show()

But I would like to have error bars with a simple horizontal line instead of arrows at the ends. But there is no "capmarker" or similar option in the plt.errorbar() function


回答1:


Remove the uplims=True and lolims=True; both limits are plotted by default, without any ending arrows:

import matplotlib.pyplot as plt

plt.errorbar(1, 0.25, yerr=0.1, fmt='o')
plt.show()

EDIT:

Increase the capsize to add caps to the end of the error bars, and increase the capthick to make the caps thicker:

plt.errorbar(1, 0.25, yerr=0.1, fmt='o', capsize=3)

plt.errorbar(1, 0.25, yerr=0.1, fmt='o', capsize=3, capthick=3)



来源:https://stackoverflow.com/questions/60708680/how-to-change-the-marker-symbol-of-errorbar-limits-in-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!