0
votes

I have 3000 .dat files which I want to plot using gnuplot.

They are all named as "iteration_1", ...", iteration_93", ..."iteration_1247",... (not in the format "iteration_XXXX", if this information is helpful).

Each of those files is to be plotted in an .eps file - my final intention is to do a video (an evolution of those plots), which I can easily make if I have the .eps files.

Is there any way to quickly command gnuplot to do this? All the questions I have found remotely similar to my situation were all actually regarding putting data from different files into one plot in a single file.

Again, I do not want to put all the plots into a single .eps file. I want 3000 .eps files.

Thanks in advance!

1

1 Answers

1
votes

Simply put your plotting routine in a do for loop. By the way, gnuplot can also do animated GIFs. Check help gif.

### create output files in a loop
reset session
set terminal epscairo

do for [i=1:3000] {
    FILE = sprintf("iteration_%d",i)
    set output FILE.".eps"
    plot FILE.".dat" u 1:2 w l    # or change your extension and plot command accordingly
}
set output
### end of code