|
From: Thomas S. <t.s...@fz...> - 2011-02-15 19:06:15
|
the script correctly identifies 0.1 as the minimum, yes, but not for all data points. you may have noticed that the 1st three y-values in the plot are '1', but should be '0.09', '0.045', and '1'. the script searches for the minimum by storing the actual y-value if it's smaller than a previous one. as long as the absolute minimum isn't found, i.e. the data line with the minumum y-value hasn't been yet read, y-values are divided by the intermediate minimum. that's the reason why the y-values are always '1' when reading my data set. bsmile wrote: > > Dear Thomas, > > I actually specifically checked whether the first script could capture a > minimum hidden in the data except for the first line. The sample data I > used > is > > 1 0.9 > 2 0.45 > 3 0.1 > 4 0.94 > 5 0.44 > 6 0.12 > 7 0.36 > > and it seems a single pass corrected identified 0.1 as the minimum. As to > your sample data, the missing of y range is a 2nd mysterious to me as if I > change the data to float, it works fine, and even if I interpret the data > to > be integer, it should still give the right answer instead of giving > constant > 1 for each dataline. > > Sincerely, > Jon > > > On Tue, Feb 15, 2011 at 2:31 AM, Thomas Sefzick > <t.s...@fz...>wrote: > >> >> 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. >> >> >> >> ------------------------------------------------------------------------------ >> 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 >> > ------------------------------------------------------------------------------ > 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-tp30924408p30934168.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |