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 # |