我有一个条形图,它从一个字典中检索它的y值.我不需要显示具有所有不同值的多个图形,而是必须关闭每个图形,我需要它来更新同一图形上的值.这有解决方案吗?
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import numpy as np
def animated_barplot():
# http://www.scipy.org/Cookbook/Matplotlib/Animations
mu,sigma = 100,15
N = 4
x = mu + sigma*np.random.randn(N)
rects = plt.bar(range(N),x,align = 'center')
for i in range(50):
x = mu + sigma*np.random.randn(N)
for rect,h in zip(rects,x):
rect.set_height(h)
fig.canvas.draw()
fig = plt.figure()
win = fig.canvas.manager.window
win.after(100,animated_barplot)
plt.show()
@H_502_13@