Different ranges dependent from date/time column

Different ranges dependent from date/time column

Post by Valentin S » Sun, 29 Jan 2006 06:54:01


I have a data file with 3 columns, the first contains dates/times in a
format which is recognized by the timeformat string timefmt '%d.%m.%Y

Now I'd like to plot the data in column 2 in a different date ranges
than the data in column 3, for example column 2 between [13:05 h, 13:30
h] and column 3 between [13:10, 13:20]. One range could easily be given
via xrange or an argument to plot, but the second range seems to be
quite difficult. My first naive attempt did not work for a reason I
understood later on, but it shows what the intension was:

set xdata time
set timefmt '%d.%m.%Y %H:%M:%S'
set format x "%H:%M"
set datafile separator "\t"
begin = "12.01.2006 13:05:00"
end = "12.01.2006 13:30:00"
t1 = "12.01.2006 13:10:00"
t2 = "12.01.2006 13:20:00"
plot [ begin: end] 'data.dat' using 1:2 w l, \
'data.dat' using 1:($1 > t1 && $1 < t2 ? $3 : 1/0) w l

Besides the problem with the ranges, the plot showed up fine -- if I
deleted the boolean condition.

Is there any function which can convert the strings t1 and t2 into the
internal-used format, e.g. seconds since 01.01.2000 00:00? Such a
conversion seems to happen to the strings begin and end in the xrange
specifier after plot. It should be quite impossible two define such a
conversion function by hand which converts years two seconds ...

Thank you very much in advance!


Different ranges dependent from date/time column

Post by Hans-Bernh » Tue, 31 Jan 2006 20:12:49

In the latest released version, there's not even a way to put the
strings into variables, much less do anything with such variables. So
I guess you must be using the development version.

The only such function is timecolumn(), and that only reads from the
data file, never from variables.

I think you'll have to resort to calling the "date" utility in
back-quote expansion to get the numeric timestamps, or do this
kind of datafile modification outside gnuplot.

Hans-Bernhard Broeker ( XXXX@XXXXX.COM )
Even if all the snow were burnt, ashes would remain.