title: Animate multiple data files in GNU-Plot
body: <p>I have around 1000 data files (filenames: data1.dat, data2.dat...... data1000.dat). 
  I am trying to animate them and create a single gif image.
  However i have failed to do so from the past 12 hours.
  The gif file gets created but it only displays the first image.</p>
  
  <p>Please have a look at my code and suggest me necessary edits.
  Thanks</p>
  
  <pre><code>set terminal gif
  set output "output.gif"
  set xr[0:400]
  set yr[-50000:50000]
  set xlabel 'Space between electrodes(um)'
  set ylabel 'Electric field (V/m)'
  set style line 1 lt 2 lc rgb "red" lw 1
  do for [i=1:100] {
     plot sprintf('data%d.dat', i) with linespoints ls 1 pointtype 0 title sprintf('data%d.dat', i)
     pause 0.1
     reread
   }
  set output
  </code></pre>