I am writing a program to read data from a txt file:
[2.8389999866485596, 2.8459999561309814, inf, 0.3540000021457672, 0.3070000112056732, 0.28700000047683716, 0.296999990940094, 0.29600000381469727]
There is no y-axis for this graph, currently this is the code that I have written:
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
def animate(i):
    f = open('sample_data.txt', 'r').read()
    lines = f.split('\n')
    xs=[] 
    ys=[]
    for line in lines:
        if len(line) > 1:
            x,y = line.split(',')
            xs.append(float(x))
            ys.append(float(y))
    ax1.clear()
    ax1.plot(xs,ys)
ani = animation.FuncAnimation(fig, animate, interval=1000)
plt.show()
But have many errors.
 
     
    