|
From: Ethan A M. <merritt@u.washington.edu> - 2009-03-13 05:23:24
|
On Thursday 12 March 2009, Juergen Wieferink wrote:
> Am Donnerstag, 12. März 2009 schrieb Ethan A Merritt:
> > On Wednesday 11 March 2009, Mojca Miklavec wrote:
> > > One more question. I know that the order of reading parameters is a
> > > pretty sensitive issue in gnuplot, but it nevertheless confused me
> > > that
> > > plot for [n=2:5] 'data.dat' using 1:n title column with lines
> > > plot for [n=2:5] 'data.dat' using 1:n with lines title "something"
> > > both work while
> > > plot for [n=2:5] 'data.dat' using 1:n with lines title column
> > > fails. Is that behaviour "compatible" with previous and future
> > > versions of gnuplot?
> >
> > It is all part of the same problem. The code that implements the
> > 'using ... title column(foo)' option is an ugly hack.
> > It is a known bug, and has been on the list of things to fix for a long
> > time.
> >
> > The reason it persists as a sore point rather than being fixed
> > immediately is that in order to work properly it needs information that
> > is only visible inside the datafile.c routines, whereas normally command
> > options are parsed elsewhere. To fix it we will have to rearrange the
> > code, and/or introduce new global variables, etc.
>
> One option would be to put the parsing code into a separate function
> in datafile.c which is called on a keyword not known within
> plot?d.c. Though I suspect that this would not be too easy. I do
> not know how to set the default title then.
You are right. It can be done that way.
I have so modified the parsing code, which now accepts:
plot ... title columnheader
plot ... title columnheader(N)
The option is now handled by the normal title parsing code, so there is
no strangeness with the order of title options on the command line.
The original form of the command, which was never documented but was
used in several of the demos, is now deprecated. However it still works
if you ./configure --enable-backwards-compatibility
Thus
plot ... using 1 title 1
should be re-written using any of the following:
plot ... using 1 title col
plot ... using 1 title columnhead(1)
set key autotitle columnhead
plot ... using 1
The change leaves one chunk of dead code in df_open() that looks like it
used to handle some exceptional case, but can now never be reached.
This may mean that the exceptional case is now broken, but I haven't
been able to work out what it was :-/ Oh well.
--
Ethan A Merritt
|