小编use*_*990的帖子

使用matplotlib.pylab在for循环中更新直方图

我正在尝试更新for直方图数据。但我不知道该怎么做 我尝试使用set_data,但无法正常工作。这是代码:

plt.ion()
ax=plt.subplot(111)
[n,X, V]=ax.hist(range(MAX_X),bins=33,normed=True)

....

alternative=defaultdict(list)
...



for z in range(0,max(alternative)):
stat=zeros(33,int)
for i in range(len(alternative[z])):
    stat[alternative[z][i]]+=1

[n,X, V].set_data(stat)// problem here!!!!!!!
plt.draw()
Run Code Online (Sandbox Code Playgroud)

python matplotlib histogram

4
推荐指数
1
解决办法
3837
查看次数

标签 统计

histogram ×1

matplotlib ×1

python ×1