comma-space separated data?

comma-space separated data?

Post by Dan Rawso » Wed, 30 Jul 2003 02:24:10



I have a data file which looks like:

date time,  series1, series2, series3, series4, series5

Note that the separators are ", " with a single space.  I would assume <!!> that the 'date time' string would be
interpreted as a single column if I use a comma separator.

When I try to plot with:

plot 'file' using 1:3 '%lf,%lf,%lf'

I get a message which says:

  "all points undefined!"

I set the xaxis with  'set xdata time'

If I modify the data file and remove the commas, everything works fine.  I also tried using '%lf, %lf, %lf' (ie,
including the actual spaces in the format string) with no success.

Any hints would be appreciated . . . .

Thanks!

Dan

 
 
 

comma-space separated data?

Post by Ethan Merri » Wed, 30 Jul 2003 02:47:01




Quote:>I have a data file which looks like:

>date time,  series1, series2, series3, series4, series5

>Note that the separators are ", " with a single space.  I would assume <!!> that the 'date time' string would be
>interpreted as a single column if I use a comma separator.

The development version supports input from csv (comma separated value)
files.  Older versions do not.  This feature was added early in 2003,
so it is not present in the version 3.8i tarball; you will need to
download the development version from SourceForge.

New syntax:

        set datafile separator ","

It is nevertheless possible to force older gnuplot versions
to read in data such as you describe, but as you have
discovered the column numbering becomes extremely confusing.
And embedded blanks or other whitespace generally messes this
up even more.

If there is no embedded whitespace, you could also try
simply removing the commas altogether.  Try:

        plot "< sed 's/,/ /g' file.csv" using ...
--
Ethan A Merritt

 
 
 

comma-space separated data?

Post by Dan Rawso » Wed, 30 Jul 2003 03:19:13





>>I have a data file which looks like:

>>date time,  series1, series2, series3, series4, series5

>>Note that the separators are ", " with a single space.  I would assume <!!> that the 'date time' string would be
>>interpreted as a single column if I use a comma separator.

> The development version supports input from csv (comma separated value)
> files.  Older versions do not.  This feature was added early in 2003,
> so it is not present in the version 3.8i tarball; you will need to
> download the development version from SourceForge.

> New syntax:

>    set datafile separator ","

> It is nevertheless possible to force older gnuplot versions
> to read in data such as you describe, but as you have
> discovered the column numbering becomes extremely confusing.
> And embedded blanks or other whitespace generally messes this
> up even more.

> If there is no embedded whitespace, you could also try
> simply removing the commas altogether.  Try:

>    plot "< sed 's/,/ /g' file.csv" using ...

OK . . .  For now I did just what you suggested in the last line . . . .  Thanks!  Since the datafile in question is
actually about 1/2 Mb, I did it in a cron task, rather than running sed every time someone clicks on the "plot" link on
the web page . . . .

Dan

 
 
 

comma-space separated data?

Post by Ethan Merri » Wed, 30 Jul 2003 03:42:49





>> If there is no embedded whitespace, you could also try
>> simply removing the commas altogether.  Try:

>>        plot "< sed 's/,/ /g' file.csv" using ...
>OK . . .  For now I did just what you suggested in the last line . . . .  
>Thanks!  Since the datafile in question is
>actually about 1/2 Mb, I did it in a cron task, rather than running sed i
>every time someone clicks on the "plot" link on the web page . . . .

sed is pretty light-weight. I doubt very much it adds a noticeable
overhead to the process even if invoked every time.

--
Ethan A Merritt

 
 
 

comma-space separated data?

Post by Hans-Bernhard Broeke » Wed, 30 Jul 2003 16:21:50



> date time,  series1, series2, series3, series4, series5
> Note that the separators are ", " with a single space.  I would
> assume <!!> that the 'date time' string would be interpreted as a
> single column if I use a comma separator.

That assumption, unfortunately, is wrong.  gnuplot can handle
comma-separated data using the format-string approach you already
found yourself, _or_ it can handle date/time input.  But not both at
the same time, sorry.

The core reason is that while numeric data get along with only one
format specifier per data item, date/time needs several, so it would
be impossible to know where one item ends and the next starts, just by
looking at the format string.
--

Even if all the snow were burnt, ashes would remain.

 
 
 

1. why no comma-separated data files?

What was the specific reason for not recognizing commas as a
column-separation character in gnuplot data input files, or not even as
a definable data separation character? Was this by any chance dictated
by the European decimal-notation convention?

Unfortunately, this forces me (and surely others) to pre-process of lot
of files with sed, since many instruments simply write dump output files
in that format and won't allow any modification/customization.  Am I the
only one to be baffled?

Tony

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

2. New Website

3. Comma delimited data to GIF

4. Quaternion Lerp

5. Associating data w/ texture without making separate copy

6. Character studio

7. Any way to separate layers into separate files?

8. Help! Montage Fr1 Slide Recorder

9. Help converting irregularly spaced data to 3d surfaces

10. Space Shuttle Data Wanted

11. replacing decimal point by decimal comma

12. comma

13. HELP Time formats with commas delimited files