|
From: Juhász P. <pet...@gm...> - 2015-12-13 16:56:42
|
On Sun, 2015-12-13 at 15:14 +0000, pl...@pi... wrote:
> Hi,
>
>
> I need to plot a series of data files and one reference file.
>
>
> here I get all the data files and one test plot
>
> plot[0:1.2] for [ len=9000:7000:-50 ] s=0 \
> , "data-".sprintf("%d",len).".out" u (1/$4):5 w l tit
> sprintf("%d",len).".out" \
> , "test_filter.out" u (1/$4):($5*1.5e08) w l tit " filter resp " \
>
>
> but this way around I get the test plot n time and only the last data
> file plotted.
>
>
> plot[0:1.2] for [ len=9000:7000:-50 ] s=0 \
> , "test_filter.out" u (1/$4):($5*1.5e08) w l tit " filter resp " \
> , "data-".sprintf("%d",len).".out" u (1/$4):5 w l tit
> sprintf("%d",len).".out" \
>
The plot and splot commands accept a comma-separated list of functions
or datafiles (or variable assignments), and the for clause counts *per
function/datafile*.
So your command essentially sets s = 0 many times, then plots your two
datafiles once.
If you omit that s=0 from your first command (it seems to be superfluous
anyway), it will do what you want. You might want to reindent the
command to show that the for clause belongs to a specific datafile, not
the entire command:
plot[0:1.2] \
for [ len=9000:7000:-50 ] "data-".sprintf("%d",len).".out" u (1/$4):5 w
l tit sprintf("%d",len).".out", \
"test_filter.out" u (1/$4):($5*1.5e08) w l tit " filter resp "
>
>
> gnuplot> help for
>
> The `plot`, `splot`, `set` and `unset` commands may optionally contain an
> iteration for clause. This has the effect of executing the basic command
> multiple times, each time re-evaluating any expressions that make use
> of the
> iteration control variable.
>
>
This section does not mention the fact that the for clause affects just
one element of the plot list, however, the "help for loops" subtopic
does:
This will plot one curve, sin(3x), because iteration ends at the comma
plot for [i=1:3] j=i, sin(j*x)
This will plot three curves because there is no comma after the
definition of j
plot for [i=1:3] j=i sin(j*x)
>
> This does not seem consistent with what happens.
>
> regards, Peter.
>
>
>
>
Peter Juhasz
|