def line_many():
plt.ion()********
for i in range(100):
plt.clf()*********
name_list = ['0',"1","2","3","4","5","6"]
num_list = [round(random.random()*100,2),round(random.random()*100,2),round(random.random()*100,2),round(random.random()*100,2),round(random.random()*100,2),round(random.random()*100,2),round(random.random()*100,2)]
rects = plt.bar(range(len(num_list)), num_list, color='rgby')
# X轴标题
index = [0, 1, 2, 3,4,5,6]
index = [float(c) for c in index]
plt.ylim(ymax=110, ymin=0)
plt.xticks(index, name_list)
plt.ylabel("arrucay(%)") # X轴标签
for rect in rects:
height = rect.get_height()
plt.text(rect.get_x() + rect.get_width() / 2, height, str(height) + '%', ha='center', va='bottom')
plt.pause(0.5) *******
plt.ioff()********
实现动态的关键就在********标记的四句