|
From: <pl...@pi...> - 2012-05-24 08:17:15
|
On 05/23/12 23:24, Ethan A Merritt wrote:
> On Wednesday, May 23, 2012 01:50:43 pm pl...@pi... wrote:
>> Hi,
>>
>> I am getting some inconsistent behaviour from comment handling.
>>
>> gnuplot> set timefmt "%d.%m.%y:%H:%M"; set xdata time; set ylab "mm Hg"
>> ; set grid
>>
>> 21.05.12:23:20 96 72 65 # wetday , not walking
>> 22.05.12:09:00 # rise 9am 81kg
>> 23.05.12:04:30 120 87 49 # work late,bed
>>
>>
>> help says:
>>
>> Comments are supported as follows: a `#` may appear in most places in
>> a line
>> and `gnuplot` will ignore the rest of the line. It will not have this
>> effect
>> inside quotes, inside numbers (including complex numbers), inside command
>> substitutions, etc. In short, it works anywhere it makes sense to work.
>
> That section is refering to gnuplot command lines, not to data files.
> The very next line says "See also `set datafile commentschars`
> for specifying comment characters in data files".
>
> gnuplot> help set datafile comment
> The `set datafile commentschars` tells `gnuplot` what characters are used in a
> data file to begin comment lines. If the first non-blank character on a line is
> one of the specified characters then the rest of the input line is ignored.
> Default value of the string is "#!" on VMS and "#" otherwise.
>
>
>
>>
>> However the middle line with the missing data tries to plot the comment !
>>
>> I'm using a plot that is essentially:
>>
>> plot datafile using 1:2, '' using 1:3 , '' using 1:4
>>
>> the first line joins 96 and120 with a straight line.
>> the second gets a break (this is what I expected for all three)
>> the last line tries to plot "9am" and so I get a line 65 9 49
>>
>> All this seems to indicate that it is parsing "#" and "rise" as NaN
>> rather than seeing the comment as a comment.
>>
>> Is this expected? If so the help needs to be changed.
>>
>> regards, Peter.
>>
OK, my bad, but this does point out something that could be done better.
gnuplot> help set datafile comment
but the following
1 # 3 4
produces rather unexpected plot unless
set datafile missing '#'
is specified as well.
Unexpected indeed. Is there a good reason why this needs to happen? I
suppose this falls into the category of "except in numbers" in 'help
comment'.
I often need to add a comment at the end of some data lines. This is OK
if all expected columns are filled since gnuplot does not try to parse
the rest.
Is there a context in which a valid data entry could begin with '#' ?
Peter.
|