How can I draw an errorbar graph without lines and points in Matplotlib?

痞子三分冷 提交于 2021-02-16 15:27:12

问题


I am currently using the following code to plot errorbar graphs.

plt.errorbar(log_I_mean_, log_V2_mean_, xerr, yerr, '.')

However, the end result shows a circular point in the center of each errorbar intersection point. How can I plot just the errorbars without the central point, as is required in scientific work?


回答1:


use 'none' instead of '.':

import matplotlib.pyplot as plt

x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)

yerr = 0.1 + 0.2*np.sqrt(x)
xerr = 0.1 + yerr

plt.figure()
plt.errorbar(x, y, 0.2, 0.4,'none')
plt.title("Simplest errorbars, 0.2 in x, 0.4 in y")

result:

P.S. this is slightly modified version of part of the example of pylab here



来源:https://stackoverflow.com/questions/40093641/how-can-i-draw-an-errorbar-graph-without-lines-and-points-in-matplotlib

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