|
From: <pl...@pi...> - 2012-05-23 20:56:55
|
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. 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. |
|
From: Ethan A M. <sf...@us...> - 2012-05-23 21:39:05
|
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. > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > |
|
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.
|
|
From: sfeam (E. Merritt) <eam...@gm...> - 2012-05-24 15:43:48
|
On Thursday, 24 May 2012, pl...@pi... wrote: > On 05/23/12 23:24, Ethan A Merritt wrote: > > 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. > > > 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. Er, what were you expecting? > 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 '#' ? Sure - why not? Data files can contain anything at all, not necessarily numeric. |
|
From: <pl...@pi...> - 2012-05-24 23:46:50
|
On 05/24/12 17:43, sfeam (Ethan Merritt) wrote: > On Thursday, 24 May 2012, pl...@pi... wrote: >> On 05/23/12 23:24, Ethan A Merritt wrote: > >>> 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. >>> > >> 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. > > Er, what were you expecting? That is what gnuplot help said , not me. The help says it can produce "unexpected" results , so I suppose you'd better ask that question of the person who wrote the doc. I''ve already stated that I expected it skip the rest of the line as a comment. That would be useful. It appears that currently there is no facility have comments other than all plotted columns being already satisfied. It would be useful when data is missing to be able to add a comment saying why in the data file. eg. 21.05.12:23:20 96 72 65 22.05.12:09:00 98 # instrument failure on channels 2 and 3 23.05.12:04:30 120 87 49 > >> 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 '#' ? > > Sure - why not? > Data files can contain anything at all, not necessarily numeric. > Yeah well, assuming that it is something that is going to be plotted it has to be numerical somewhere along the way. You can't plot "hash" . Unless # can be part of a numeric input , or valid data is some other way , I see no utility in not parsing it as indicating a comment and ending parsing the line for data. Am I missing something useful? Peter. |
|
From: Jonathan T. <jt...@as...> - 2012-05-25 00:51:22
|
On Thu, 24 May 2012, pl...@pi... wrote:
> I''ve already stated that I expected it skip the rest of the line as a
> comment. That would be useful. It appears that currently there is no
> facility have comments other than all plotted columns being already
> satisfied.
>
> It would be useful when data is missing to be able to add a comment
> saying why in the data file.
>
> eg.
>
> 21.05.12:23:20 96 72 65
> 22.05.12:09:00 98 # instrument failure on channels 2
> and 3
> 23.05.12:04:30 120 87 49
You can do this with current gnuplot, but the comment needs to start
in column 1, e.g.,
21.05.12:23:20 96 72 65
# next line has only 1 column due to instrument failure on channels 2 and 3
22.05.12:09:00 98
23.05.12:04:30 120 87 49
--
-- "Jonathan Thornburg [remove -animal to reply]" <jt...@as...>
Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
|
|
From: Ethan A M. <sf...@us...> - 2012-05-25 00:48:08
|
On Thursday, May 24, 2012 11:59:59 am pl...@pi... wrote:
> On 05/24/12 17:43, sfeam (Ethan Merritt) wrote:
> > On Thursday, 24 May 2012, pl...@pi... wrote:
> >> On 05/23/12 23:24, Ethan A Merritt wrote:
> >
> >>> 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.
> >>>
> >
> >> 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.
> >
> > Er, what were you expecting?
>
> That is what gnuplot help said , not me. The help says it can produce
> "unexpected" results , so I suppose you'd better ask that question of
> the person who wrote the doc.
I'm not sure what it's trying to say.
Just that # doesn't act as a comment in that case.
OK, I'll look at re-wording it.
> I''ve already stated that I expected it skip the rest of the line as a
> comment. That would be useful. It appears that currently there is no
> facility have comments other than all plotted columns being already
> satisfied.
>
> It would be useful when data is missing to be able to add a comment
> saying why in the data file.
>
> eg.
>
> 21.05.12:23:20 96 72 65
> 22.05.12:09:00 98 # instrument failure on channels 2
> and 3
> 23.05.12:04:30 120 87 49
>
> >
> >> Unexpected indeed. Is there a good reason why this needs to happen?
What is "this"? For most plot commands, if the expected numerical
data columns are not present then the line will be skipped.
You can construct pathological cases where that doesn't happen, but
it's true in general. This doesn't depend on the presence or absence
of any specific comment character, however.
> >> Is there a context in which a valid data entry could begin with '#' ?
> >
> > Sure - why not?
> > Data files can contain anything at all, not necessarily numeric.
> >
>
> Yeah well, assuming that it is something that is going to be plotted it
> has to be numerical somewhere along the way. You can't plot "hash" .
Sure you can. Here's a plot command that maps characters in a
data field onto a numerical value and then plots the distribution.
gnuplot> category = "ABC#@*!"
gnuplot> COL = 4
gnuplot> plot 'charfile' using (strstrt(category,strcol(COL))) : (1) \
smooth freq with impulses
This command has the peculiarity that it fails for COL = 1
unless you unmap # as a comment character. But it works for all other columns.
> Unless # can be part of a numeric input , or valid data is some other
> way , I see no utility in not parsing it as indicating a comment and
> ending parsing the line for data.
>
> Am I missing something useful?
Data files can contain character data
Character data can contain #
|
|
From: <pl...@pi...> - 2012-05-25 07:41:51
|
On 05/25/12 02:46, Ethan A Merritt wrote: > On Thursday, May 24, 2012 11:59:59 am pl...@pi... wrote: >> On 05/24/12 17:43, sfeam (Ethan Merritt) wrote: >>> On Thursday, 24 May 2012, pl...@pi... wrote: >>>> On 05/23/12 23:24, Ethan A Merritt wrote: >>> >>>>> 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. >>>>> >>> >>>> 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. >>> >>> Er, what were you expecting? >> >> That is what gnuplot help said , not me. The help says it can produce >> "unexpected" results , so I suppose you'd better ask that question of >> the person who wrote the doc. > > I'm not sure what it's trying to say. > Just that # doesn't act as a comment in that case. > OK, I'll look at re-wording it. > >> I''ve already stated that I expected it skip the rest of the line as a >> comment. That would be useful. It appears that currently there is no >> facility have comments other than all plotted columns being already >> satisfied. >> >> It would be useful when data is missing to be able to add a comment >> saying why in the data file. >> >> eg. >> >> 21.05.12:23:20 96 72 65 >> 22.05.12:09:00 98 # instrument failure on channels 2 >> and 3 >> 23.05.12:04:30 120 87 49 >> >>> >>>> Unexpected indeed. Is there a good reason why this needs to happen? > > What is "this"? For most plot commands, if the expected numerical > data columns are not present then the line will be skipped. > You can construct pathological cases where that doesn't happen, but > it's true in general. This doesn't depend on the presence or absence > of any specific comment character, however. > The "this" was parsing the hash that would normally introduce a comment as data . This was what I originally described when opening this thread. Sorry if that was not clear. > >>>> Is there a context in which a valid data entry could begin with '#' ? >>> >>> Sure - why not? >>> Data files can contain anything at all, not necessarily numeric. >>> >> >> Yeah well, assuming that it is something that is going to be plotted it >> has to be numerical somewhere along the way. You can't plot "hash" . > > Sure you can. Here's a plot command that maps characters in a > data field onto a numerical value and then plots the distribution. > > gnuplot> category = "ABC#@*!" > gnuplot> COL = 4 > gnuplot> plot 'charfile' using (strstrt(category,strcol(COL))) : (1) \ > smooth freq with impulses > > This command has the peculiarity that it fails for COL = 1 > unless you unmap # as a comment character. But it works for all other columns. Thanks, that is the information I was seeking originally when I asked whether hash could be part of valid data input. Now I know why it is not parsed as a comment. So, as you point out this does not work in column one where it is taken and the comment char. So currently this feature is buggy. Now, my real life example of one or more missing data preventing me adding a comment is hardly "pathological". Data files are rarely perfect and the need to add comments is real and useful. However, the category syntax you propose here to show the (only?) case where this would be valid input data does seems at least rather unusual and improbable. Since this example case is inconsistent in that it does not work for column one but does for the rest , would it not be better simply to exclude hash from the possible values for 'category' and make the feature self-consistent (without the col 1 peculiarity) thus freeing up the hash mark to exclusively introduce comments , ie end the parsing of the input line, be it in command script or data input. That would seem to be both useful and more consistent. regards, Peter > >> Unless # can be part of a numeric input , or valid data is some other >> way , I see no utility in not parsing it as indicating a comment and >> ending parsing the line for data. >> >> Am I missing something useful? > > Data files can contain character data > Character data can contain # > > |