我是Matplotlib的新手,花了很多时间试图弄清楚如何在第一次运行我的代码后更新我的简单Matplotlib图。生成绘图后,我的代码在plot.show()之后停止。如何通过这一点获取我的代码以从列表中重新加载新数据?以下是我的代码摘要:
import matplotlib.pyplot as plt
# here i have code that generates new_data every 2 minutes
data-gathering code
new_data = [1,3,4,6,-4,2,11]
#here i display that data, but i cant get my code to get past the first display of the plot so it can generat new data and add it to the plot
plt.plot(new_data, 'ro')
plt.ylabel('my data results')
plt.show()