From: <pl...@pi...> - 2012-05-20 08:36:50
|
On 05/19/12 17:37, sfeam (Ethan Merritt) wrote: > On Saturday, 19 May 2012, pl...@pi... wrote: >> A test of whether the behaviour is the same would be to use a variable >> to define the data source: >> >> datasrc='file1.dat' >> plot datasrc, datasrc >> >> datasrc='-' >> plot datasrc, datasrc >> >> It would be nice if gnuplot was data source agnostic in that way, but I >> can see why it was thought to be more useful to treat '-' as a special case. > > You should probably add to the mix: > > datasrc="< date +%N" > > All three of these work. Does that make the program "source agnostic"? Clearly not , if it does not produce the same result. > The first will probably produce the same result twice, > though only if the file contents are unchanged. > The second may or may not produce the same result twice, > depending on what is in the input stream. The second case will 100% _not_ produce the same result , it is plotting two different sets of data. Even if the numbers are the same, it is plotting different data sets. The behaviour is different. > The third definitely will not find the same number twice. > > It's fair enough to say that the second option, '-', > doesn't do what you want. Which is why I was suggesting a new syntax with more compatible behaviour. I've now dropped that idea having seen the divergence of requirements. But I don't see the logic for > calling it a special case. It's one of several options > for defining a data source. Use it only if it is suitable. > > Empty quotes '' mean "use the previous data _source_", > not "use the previous _data_". > > Anyhow, I would find it helpful to hear more about the use cases > where reading data from a separate file is not suitable. > Is it just a concern that the script and the data will get > separated? My initial motivation here was that I have a data file with several columns of data. To plot it I need a few lines of gnuplot script to set axes labels etc. but it can be done in a couple of lines. It's too complex to be typed in every time but it is a pain to maintain a separate script and data file for such a trivial situation. More than one file becomes an 'archive' and requires version matching, etc. A single file is much simpler to maintain reliably. I have gnuplot scripts that run to two pages, there it warrants being a file in it's own right, for two lines it's a headache. The work around you suggested , writing the data out to a second, temporary file, would work if we had the <<EOF perl-like syntax. ( I still like that syntax idea. ) But making a file dupe itself seems a bit of a kludge. Are there technical issues about multiple data files? > Speed? Would it solve the problem if you could define a separate > datablock in the same input file (separate from the 'plot' command > line)? > Yes, maybe defining the data may provide a solution to the case I outlined above and may fit in with what Allin is suggesting. Since the other three input sources produce incompatible results, perhaps this one could provide the cached , matrix capabilities that Allin was looking for. Peter. |