You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
702 B

#!/usr/bin/env python3
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig, ax = plt.subplots()
data_path = sys.argv[1]
f = open(data_path)
# first line is x values
line = f.readline().strip()
if ',' in line:
sep = ','
else:
sep = ' '
x = np.fromstring(line, sep=sep)
# second line is y values at time 0
y = np.fromstring(f.readline().strip(), sep=sep)
graph, = ax.plot(x, y)
def animate(line):
y = np.fromstring(line.strip(), sep=sep)
print(np.max(y))
graph.set_ydata(y)
return graph,
ani = animation.FuncAnimation(fig, animate, f, interval=100, blit=True,
repeat=False)
plt.show()