|
From: Thomas S. <t.s...@fz...> - 2011-02-15 08:31:34
|
strictly speaking, nunzio's script only works if the smallest number is in the 1st data line. an example: #ts.dat: 1 10 2 9 3 8 4 7 5 6 6 5 7 4 8 3 9 2 10 1 #script: min=10**10 grab(x)=x<min?min=x:min=min plot 'ts.dat' using 1:($2/grab($2)) gives a horizontal line and a warning about the empty y-range. this means that gnuplot behaves like other programming languages and there is no magic behind it. a 2nd plot gives the correct result, as you have pointed out, because then 'min' already contains the smallest value. #script: min=10**10 grab(x)=x<min?min=x:min=min plot "ts.dat" using 1:($2/grab($2)), "" using 1:($2/grab($2)) ... , "" using 1:($2/grab($2)) is equivalent to ... , "" using 1:($2/min) bsmile wrote: > > Dear Thomas, > > Nunzio Losacco wrote a short script to get each number divided by the > smallest number in a specific column, as > min=10**10 > grab(x)=x<min?min=x:min=min > plot 'disy.100' u 1:($3/grab($3)) > > I don't quite understand the logic behind although I checked that it works > fine. If I were to do this, I would write something like > > set term dumb > min=10**10 > plot 'disy.100' u ($3<min?min=$3:min=min,$1):3 > > set term x11 > plot 'disy.100' u 1:($3/min) > > and you easily see the idea I wrote it this way. I think this reflects a > big > problem for me to understand deeply how gnuplot deals with datafile and > how > it plots, which is obviously different from the standard programming > languages. Thanks for your in-depth explanation or references, > > Sincerely, > Jon > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/explanation-to-a-short-script-tp30924408p30928896.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |