it probably might be easier if your data looked the following way:
2x2 t[0] t[1]
x[0] f(0,0) f(0,1)
x[1] f(1,0) f(1,1)
If your data already exists with columns x[..]
and rows t[..]
there is probably also a way to do it, but probably a bit more complicated.
The following example will create some dummy data (writes it also into a file) and will plot it into an animated GIF. In gnuplot, also check help gif
for more information. Change the code to your needs.
### create some animated graph
reset session
set term gif size 300,300 animate delay 10 loop 0 optimize
set output "Animate.gif"
# create some dummy data
m = 50
n = 50
set print $Data
temp = sprintf("%gx%g\t",m,n)
do for [j=1:n] {
temp = temp.sprintf("t[%g]",j)
if (j<n) {temp = temp."\t"}
}
print temp
do for [i=1:m] {
temp = ""
do for [j=1:n] {
temp = temp.sprintf("%g", sin(2*pi*j/real(n)+2*pi*i/real(m)))
if (j<n) {temp = temp."\t"}
}
temp = sprintf("x[%g]\t",i).temp
print temp
}
set print "Animate.dat"
print $Data
set print
# dummy data finished
FILE = "Animate.dat"
stats FILE u 0 nooutput
set yrange[-1:1]
set xtics 10
set grid xtics, ytics
do for [i=2:STATS_columns] {
plot FILE u 0:i w lp lt 7 lc rgb "red" title columnhead(i)
}
set output
### end code