|
From: Teo S B. <teo...@gm...> - 2010-02-12 19:26:45
|
On Fri, Feb 12, 2010 at 7:07 PM, Ethan Merritt <merritt@u.washington.edu>wrote: > On Friday 12 February 2010 09:58:45 Teo S Bernhard wrote: > > Problem: > > Gnuplot script that set parameter repeatedly in plot command to address > the > > data index (within a data file) does not work when using gnuplot version > > 4.4.0-rc1. > > It works in 4.2 version and, from memory, did also work in version 4.3. > See > > the below shortened example reproducing the error message: > > > > > > # file: trial.gpl > > f(x)=x > > plot a=1, \ > > f(x)*a title "data from index a=1" w l lw 2 lt a , a=a+1, \ > > f(x)*a title "data from index a=2" w l lw 2 lt a , a=a+1, \ > > a=0 > > Please see Bug #2907028 > > https://sourceforge.net/tracker/?func=detail&aid=2907028&group_id=2055&atid=102055 > > So far as I can tell from running old versions of gnuplot (back to 3.7), > it never did work correctly to increment a variable multiple times inside > a plot command. > > Test of referred bug report: I have tested and it is is reproducible. There is however a subtle difference with my example and that of the bug report. Note that I initiate the counter variable first in the plot command. Then - the problem vanish. The parameter incrementation is then correct! You can convince yourself by trying the following: k=0 plot [0:1] [-1:] k=0, \ k*x t '0x' w lp lt 1, k=k+1, \ k*x t '1x' w lp lt 2, k=k+1, \ k*x t '2x' w lp lt 3 Now, if you remove the initial 'k=0, \' part of the plot-command - the '0x'-line is plotted as 2*x, the '1x'-line as 3*x and '2x'-line as 4*x. Can this be related to the two 'k=k+1' for some strange reason? In deed, adding a third 'k=k+1' leads the first '0x'-line to be plotted as 3*x! This is clearly a bug since k is expected as zero for the first line to be plotted, '0x'. I therefore think there are two issues here: 1) The issue reported as Bug #2907028 and 2) the issue reported by me here, that version 4.4 does not allow an increment as the last statement of a plot-command. This test on Ubuntu 8.04, gnuplot 4.2 patchlevel 2 and gnuplot 4.3 patchlevel 0. > pause -1 "Continue?" > > > > # > > # gnuplot 4.2 patchlevel 5 accepts the above. I believe that also > > # gnuplot 4.3 accepted this. > > # > > # gnuplot-4.4.0 patchlevel 0-rc1 give error: > > # "trial.gpl", line 6: function to plot expected > > # > > # > > # It works if I add a dummy curve after a=0, so that last line > > # becomes: > > # a=0, x/0 > > # > > exit > > > > Best regards > > Teo > > > > |