|
From: Ethan A M. <merritt@u.washington.edu> - 2006-03-20 01:30:28
|
You may have seen on comp.graphics.apps.gnuplot
that someone wanted to plot X-axis time data from a file that
looked like this:
#My data file
"2006-03-06 10:25:35" 0.000006914139 0.000051975250
"2006-03-06 10:25:38" 0.000007867813 0.000027894974
...
Note the quotes around the time.
One might think that this could be handled by
set timefmt '"%Y-%m-%d %H:%M:%S"'
But it isn't, because the input parsing code in datafile.c
assumes that something in quotes cannot be valid numeric
(or in this case time format) data.
What do you think - is this a bug, or is it perfectly
reasonable to say that input data should not be in quotes
unless it really is string data?
The specific case reported can be handled by the following
patch. But it this a desirable thing to do?
diff -ur gnuplot/src/datafile.c gnuplot-cvs/src/datafile.c
--- gnuplot/src/datafile.c 2006-03-17 22:41:30.000000000 -0800
+++ gnuplot-cvs/src/datafile.c 2006-03-19 17:17:27.000000000 -0800
@@ -721,6 +721,9 @@
if (*s == '"') {
in_string = !in_string;
df_column[df_no_cols].good = DF_MISSING;
+ /* DEBUG - ALLOW TIMEFMT DATA TO BEGIN WITH A QUOTE */
+ if (axis_array[df_axis[df_no_cols]].timefmt)
+ df_column[df_no_cols].good = DF_UNDEFINED;
} else if (check_missing(s))
df_column[df_no_cols].good = DF_MISSING;
else {
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742
|