|
From: Ethan M. <merritt@u.washington.edu> - 2009-11-11 20:16:00
|
On Wednesday 11 November 2009, Hans-Bernhard Bröker wrote:
> Ethan Merritt wrote:
>
> > Of course a string is required. It is going to become the
> > first N characters of a longer string.
>
> Erm, no. It's going to become the first N characters of a variable name.
You are missing the point that in order for it to be useful in a script,
I have to be able to construct the prefix dynamically, which means
I need to handle the prefix itself as a variable. Hence: a string variable.
> > How could it be anything other than a string itself?
>
> By being a (partial) variable name. And I don't [think] we ever quote a
> variable name in gnuplot.
Yep. It's a partial name of something. In other words, it is a substring
of the full name. To specify or manipulate this substring, I want to put
it in a string variable.
If these names can not be manipulated as variables, and it does seem that
nasty issues are poking their heads out of holes in the woodwork, then
I don't see any point to having them. Just pick a fixed set of names and
be done with it. But then we'll have to come up with some other mechanism
for dealing with multi-column data files, and so far I haven't heard any
other suggestions.
I am talking about real-world cases here. To plot multiple curves from a
data file I need to be able to iterate over the columns in the data file.
I can provide sample data and the desired output if you like.
If the stats functionality were embedded in the 'plot' command itself,
then I could intersperse reloading of the stats output values with the
individual clauses of the plot command:
plot \
'datafile' stats ($5), '' using ($5/stats_max), \
'datafile' stats ($6), '' using ($6/stats_max), \
...
Note that each time "stats_max" is encountered during evaluation of the
plot command, it has been reloaded with a new value by the preceding
stats clause. That works fine for iteration:
plot for [i=5:20] 'datafile' stats (column(i)), '' using (column(i)/stats_max)
But if the stats are collected via a separate command then, as I
discovered the hard way, it is very cumbersome to collect them into a single
multi-column plot command. This is true even aside from the question of
using iteration, which anyhow isn't possible with the prototype stats
implementation.
|