|
From: <pl...@pi...> - 2014-04-23 23:51:47
|
On 04/23/14 20:47, Ethan A Merritt wrote: > > On Sunday, 20 April, 2014 10:48:10 pl...@pi... wrote: >> HI, >> >> >> I often use conditional using clauses to plot part of a range of data >> >> plot datafile using (($1<=1995.55)?$1:NaN):(2*fcos1($1)) >> >> I tried this when writing to a file specified with "set table" and >> instead of cutting off the output, it appends garbage data with a "u". >> >> help table tells me this means "undefined" >> >> I see two problems here. I did not ask for undefined output , I >> specified NaN. >> >> Secondly , what is the possible use of "undefined" values in a data file? >> >> 1995.46 1.00914 i >> 1995.54 1.10947 i >> 1.98547e-81 4.74363e+170 u >> 3.75845e+174 7.52884e-24 u >> 0 2.122e-314 u >> 0 0 u >> 0 0 u >> 1.9771e+161 1.44402e+214 u >> -1.22337e-44 1.1735e-319 u >> 1.01887e+189 7.49746e+247 u >> 5.35166e+199 2.10124e+88 u > > I do not know what the original idea was, > nor do I know if there are existing scripts that depend on the 'u'. > It does seem pointless to write out total junk values as in your example. > > If it helps, version 5 has a new mode "with table" that does what you want. > > gnuplot> set samples 11 > gnuplot> set xrange [0:10] > gnuplot> set table > gnuplot> plot '+' using ((4<$1&&$1<8) ? NaN : $1) : ($1**2) with table > 0 0 > 1 1 > 2 4 > 3 9 > 4 16 > nan 25 > nan 36 > nan 49 > 8 64 > 9 81 > 10 100 > gnuplot> > > This is not ideal because it requires a separate plot style, which means > you can't do > plot $foo; set table; replot > > Should tabular output of the regular plot styles be changes to match this? > What, if anything, depends on the old behavior and would break? > > Ethan > > Is it a safe bet that no one has a script that relies on meaningless junk? This was presumably an oversight when NaN was added. Is anyone really using this "feature"? It's more an inconsistency than a howler of a bug, so wouldn't v5 be a good opportunity to profit from the relaxation of b/c rules and fix it? What is the most consistent with a terminal plot ? Terminals produce no output for NaN points. Producing no output into the table would seem to be the best equivalent to me. That is the behaviour I was expecting , at least. There may be a case for outputting NaN in column 1 and the expression in col 2 but this could fail , for example , if I was doing the NaN trick to prevent evaluation of the expression in a range where it would fail. f(x)=1/x; plot datafile using (($1<0)?$1:NaN):(2 * f($1)) so perhaps NaN NaN ?? I think no output is the most consistent with no point in a plot unless someone can see something I've missed. /Peter |