KPJ
KPJ

Reputation: 25

Animate multiple files with gnuplot

Say I have 'file1.asc', 'file2.asc' ... 'file 20.asc'. For each of these file, splot command in gnuplot represents an ellipsoid.

But I want to animate stacking all these files on a single plot and see these different ellipsoid.

I tried commands like:

do for [i=1:20] {splot  'data'.i.'.asc' using 4:5:6 with lines} 

or

splot for [i=1:20] 'data'.i.'.asc' using 4:5:6 with lines

but none of them shows a continuos animation. I this command in a script "try". And the entered "gnuplot try" on command prompt. But no luck.

Upvotes: 2

Views: 5686

Answers (1)

Christoph
Christoph

Reputation: 48430

In order to get a rather smooth animation you must introduce a little delay between two plots with the pause command:

do for [i=0:10] { plot i*x title sprintf('%d', i); pause 0.5 }

In the same way, for your file you'll need

set style data lines
do for [i=1:20] { splot sprintf('data%d.dat', i) using 4:5:6; pause 0.5 }

Upvotes: 1

Related Questions