I have many datafiles, named file1.dat, file2.dat, file3.dat and so on
up to a large number (about 1000, e.g. data1000.dat). How Do I plot them
into a single plot? I dream of something like
...
for i=1:1000
plot "data<i>.dat" using 3:4 with lines
end
...
Is this possible by means of gnuplot? Any help is appreciated!
Regards
Henning
In recent versions of gnuplot (e.g. 4.4) there is the possibility of
iterations. Have a look at "help plot iteration" and "help
sprintf". Something like
plot for [i=1:1000] sprintf('data%i.dat', i) using 3:4 with lines
might be what you are searching for.
Juergen
Thanks a lot! This works fine for me!
Regards,
Henning
Even more versatile is the following syntax:
list = "`echo $(ls data*.dat file*.dat)`"
plot for [i in list] i using 1:2 w l tit i
This allows you to use more than one file specifications to gather
file names in the variable 'list', then iterate over that list and
plot the files one by one.
Péter Juhász
True. But as backticks are depricated (or IMHO should be, at least
within strings), you can use
list = system("echo $(ls data*.dat file*.dat)")
instead.
Juergen