From: Tait <gnu...@t4...> - 2012-05-17 23:32:52
|
> > f(x,y,z)=<some function> > > g(x)=<some other function> > > plot 'datafile' using (column(f($1,$2,$3))):(column(g($4)), \ > > 'data2file' using ($1>$2 ? column(g($4)) : 1/0) > > I think your example needs to be stripped down to the bare essentials of > making the point you are trying to make. I'll have a guess about what > you are trying to say, sorry if I miss the mark, and I think you are > mistaken. I was trying to make two separate points in that example, and you missed the first -- and more important -- of them. To simplify: plot 'datafile' using (column($1)) The column to be used for data is the column specified in the first column of the data file. This is not and cannot be known until the file (that column, at least) is actually read. The point of including the functions is that we might not even know based on a single line of the input what column we would need to preserve. The only way to know what must be preserved is to actually evaluate the using conditions on the input, see what results, and then reread the file for the next plot because it, too, may have the exact same dereferencing behavior that the first using statement had. And even more so, to the extent the first using evaluation had side-effects that alter the meaning of the second using statement, these side-effects cannot be anticipated ahead-of time without actually doing the calculations demanded by the user. These kinds of side effects are already suggested by demos like http://gnuplot.sourceforge.net/demo_4.6/running_avg.html. In short, the current behavior of gnuplot makes it impossible to do a single-pass read of the data file. We could break the current behavior, of course, but then we explicitly decrease the flexibility we have for the sake of introducing other inconsistent and backward- incompatible magic behavior. At risk of repeating myself, caching may be worthwhile, but not in the way and with the syntax you've suggested. > > ... The behavior of '-' is currently the same as > > for a data file. ... > > No, you need to read up on how '-' works. This has been covered in a > number of posts in this thread. I know exactly how it works, and it works just like data files work. I use and rely on this behavior. The behavior you want, and that you (incorrectly, imo) describe as being the same as what's done for data files is different. When you say plot 'file1', '', gnuplot does not save 'file1' and rewind through this cache to find the data it needs when plotting the ''. It plots 'file1', then when it sees '' it reads 'file1' (again). When gnuplot plots '-', it reads the inline data, and when it sees '' after, it reads the inline data again, not a cached copy that it rewinds and replays. The fact that '-' might be different on the first and second read is exactly the same as 'file1' might be different on the first and second read. This describes the same behavior for both 'file1' and '-'. What you're asking for is that unlike the 'file1' case, '-' be handled differently, so that it saves or caches the data and rewinds back and forth through this cache instead of reading anew. This sort of special-case handling of '-' might be a worthwhile option, but it's a separate feature, and one that must be kept optional so as to not break backward compatibility and important use cases for some users (like me). |