diff --git a/animate2 b/animate2 new file mode 100755 index 0000000..1110168 --- /dev/null +++ b/animate2 @@ -0,0 +1,40 @@ +#! /usr/bin/env python + +import numpy as np +import glob +import matplotlib.pyplot as plt +from matplotlib.animation import FuncAnimation + +# get the filenames, make sure they are sorted in time +f = glob.glob('run1/tab/LinWave*tab') +f.sort() + +# 1-based columns numbers for now +xcol = 3 +ycol = 5 + +# delay in ms +delay=100 + +# create the figure and axes objects +fig, ax = plt.subplots() + +# function that draws each frame of the animation +def animate(i): + # print(f[i]) + d = np.loadtxt(f[i]).T + x = d[xcol-1] + y = d[ycol-1] + + ax.clear() + ax.plot(x, y) + #ax.set_xlim([0,20]) + #ax.set_ylim([0,10]) + ax.set_title(f[i]) + + +# run the animation +ani = FuncAnimation(fig, animate, frames=len(f), interval=delay, repeat=False) + +plt.show() +