Jul-24-2018, 02:12 PM
Sorry but the second code must be this one
import matplotlib.pyplot as plt import matplotlib.animation as animation import time fig = plt.figure() def animate(i): ax1 = fig.add_subplot(1,1,1) pullData1 = open("data1.txt","r").read() dataArray1 = pullData1.split('\n') xar = [] yar = [] for eachLine in dataArray1: if len(eachLine)>1: x1,y1 = eachLine.split(',') xar.append(int(x1)) yar.append(int(y1)) ax1.clear() ax1.plot(xar,yar) ani = animation.FuncAnimation(fig, animate, interval=1000) plt.show()