我正在尝试创建一个动画绘图从一个文本文件,我在以前的代码中使用Odeint生成的。此外,系统的状况已被记录到不同的文本文件中。我已经把这些信息分成2个数组,分别是数字和条件。从这里开始,我将条件转换成我希望每个条件都显示为的文本,并将其存储在“文本框”中。现在,使用matplotlib,我想创建一个动画绘图,其中数据和文本都会出现和更改。下面是我的代码:import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.axes as text_maker
import time
# Read in the data for plotting DifEq solutions to x''=-x+c*x'+(Fo/m)cos(w*t)
data = open('data.txt','r')
# declare an array to hold the data
numbers = np.zeros((30,1001),dtype=float)
i = 0
j = 0
# loop through each line to put all data into its own column in array
for line in data:
x=line
if x=='XXXXXXXXXXXX\n': # each set ended with x string
i=i+1