|
From: <pl...@pi...> - 2007-05-08 10:16:55
|
On Tue, 08 May 2007 09:23:01 +0200, <pl...@pi...> wrote:
> Example:
> MAX =3D -999
> update_max(x) =3D assign("MAX", x > MAX ? x : MAX)
> plot <foo> using 1:($2 + 0. * update_max($2))
> print "Maximum data value plotted was", MAX
> Comments:
> I'm not sure this will actually accomplish what you want, but
> please try it out and let us know. If you use this inside a
> "using" clause, it will slow down data input. For large data files
> the slowdown is likely to be noticeable. For the use above, it
> would probably be more convenient to have the update_max(x) function
> return the current value of x rather than the updated maximum.
> It's not clear to me how best to achieve that.
shift the 'times zero' trick inside the funtion?
catch_max(y) =3D y+ 0. * assign("MAX", y > MAX ? y : MAX);
plot <foo> using 1:(catch_max($2))
pretty much the same thing but like you say a bit more convenient for pl=
ot.
;)
|