You have several possibilities:
- you can use a "template".
For instance if you have the following file foo.gpl:
#foo.gl
set term png
set output "OUTFILE"
plot "DATAFILE" using 1:2 with lines
you can then use a shell script to modify your template:
#!/bin/bash
for i in {01..09}
do
sed 's/DATAFILE/conf-a'${i} s/OUTFILE/graph'${i}'.png/' template.gnuplot > /tmp/foo
gnuplot /tmp/foo
done
rm /tmp/foo
with something like (not tested):
in gnuplot, you do
i = 1
n = 9
set term png
load "loop.gpl"
with loop.gpl containing:
datafile = "conf-a0".i
outfile = "graph".i.".jpg"
set output outfile
plot datafile using 1:2 with lines
set output
i=i+1
if (i <= n) reread
(you have a similar answer here)
you can use foor loop:
do for [t=0:9] {
datafile = sprintf('conf-a0%f',t)
outfile = sprintf('graph%f.png',t)
set output outfile
plot datafile using 1:2 with lines
}
Edit:
using your info:
cat newloop.gpl
:
datafile = "data-a0".i
outfile = "graph0".i.".png"
set output outfile
plot datafile w lp lw 2.5
i=i+1
set output
if (i <= n) reread
in gnuplot:
gnuplot> i = 1
gnuplot> n = 5
gnuplot> set grid
gnuplot> set logscale x
gnuplot> set xlabel 'P (kPa)'
gnuplot> set ylabel 'Z'
gnuplot> set format y "%.2f"
gnuplot> set format x "10^{%L}"
gnuplot> set title 'Coordination number in isotropic pressure cycle'
gnuplot> set pointsize 2
gnuplot>
gnuplot> load "newloop.gpl"
That produces graphs of different sizes:
-rw-rw-r-- 1 fred fred 5430 avril 17 23:20 graph01.png
-rw-rw-r-- 1 fred fred 5228 avril 17 23:20 graph02.png
-rw-rw-r-- 1 fred fred 5248 avril 17 23:20 graph03.png
-rw-rw-r-- 1 fred fred 5685 avril 17 23:20 graph04.png
-rw-rw-r-- 1 fred fred 5818 avril 17 23:20 graph05.png