While I was coding and got interrupted... @Ethan's answer already contains all the necessary ingredients, I post my answer nevertheless, with a little visual demo...
Check help gif, help stats and help every, these are the main "components".
In the following example you hopefully find what you are looking for.
Code:
### trajectory animated
reset session
# create some test data
v = 40
a = 45
g = 9.81
set print $Data
do for [i=0:86] {
t = i/10.
sx(t) = v*cos(a)*t
sy(t) = v*sin(a)*t - 0.5*g*t**2
print sprintf("%.3f %.3f",sx(t),sy(t))
}
set print
set xrange[0:200]
set yrange[0:80]
set term gif size 400,300 animate delay 5 optimize
set output "Trajectory.gif"
stats $Data nooutput
N = STATS_records
do for [i=0:N-1] {
plot $Data u 1:2 every ::::i w l notitle, \
'' u 1:2 every ::i::i w p pt 7 lc rgb "red" notitle
}
set output
### end of code
Result:
