【发布时间】:2019-03-17 16:49:07
【问题描述】:
尝试
我尝试使用 matplotlib 3.0.3 在 python3.7 中绘制一些直方图,但遇到了问题:
代码:
ind = np.arange(2)
width = 0.35
data = [(0.5, 0.1), (0.8, 0.3)]
for i in data:
plt.bar(ind, i[0], width, yerr=i[1])
plt.ylabel('scratchwidth /cm')
plt.show
输出:
我希望有两个条形图,(0|0.5) 和 (1|0.8) 具有不确定性 0.1 和 0.3。我得到的是两个条形图,它们都具有 y=0.8 和 0.3 的不确定性。 plt.bar() 不能在 for 循环中工作吗?
我该如何解决这个问题?
【问题讨论】:
标签: python matplotlib histogram