|
From: Armin A. <aar...@nd...> - 2008-10-14 17:05:38
|
Hi, I'm trying to plot a time series that shows data as a function of (elapsed) time. I'm using the following x-axis formatting: set xrange ["00:00:00":"60:00:00"] set xtics "0:00","6:00" set format x "%H:%M" My problem is that after 24 hours I get "00:00" instead of "24:00" in other words, the x-labelling wraps around every 24 hours rather than incrementing linearly. Question: Is there a way to force the xlabels to increment beyond 24 hours. Note: I don't want to use a different format that displays days as well, I want to keep it in the "hh:mm" formatting. Thanks, Armin -- View this message in context: http://www.nabble.com/Plotting-a-time-series-%28elapsed-time%29-with-time-values-%3E-24-hours-tp19975946p19975946.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2008-10-14 18:18:55
|
Armin Armbruster wrote: > I'm using the following x-axis formatting: > > set xrange ["00:00:00":"60:00:00"] You forgot to show your timefmt setting, but it's highly doubtful this will do anywhere near what you think it does. Try "show xrange" afterwards to see what you get, then read "help timefmt" again to see why. > set xtics "0:00","6:00" This makes even less sense. You can't really have the xtics starting point in a different time/date format than the xrange endpoints. And it rather rarely makes sense to give the <increment> of a tic setting as a data string, since it's not an absolute time, but a difference. Just give the number of seconds instead. > My problem is that after 24 hours I get "00:00" instead of "24:00" in other > words, the x-labelling wraps around every 24 hours rather than incrementing > linearly. How do you think gnuplot is supposed to guess a new day started if your data (and the timefmt setting) don't contain information about days? > Question: Is there a way to force the xlabels to increment beyond 24 hours. No. > Note: I don't want to use a different format that displays days as well, I > want to keep it in the "hh:mm" formatting. The output format is independent. |
|
From: Armin A. <aar...@nd...> - 2008-10-15 14:21:29
|
Sorry, I guess I should have added a bit more information. The plot attached is generated using the following sequence: set style data lines set xdata time set timefmt "%H:%M:%S" set format x "%H:%M" plot 'test.dat' u 1:2 The plot looks the way I would like it to look, except for the labels on the x-axis. As you can see from the data file, the data is logged as elapsed time from an arbitrary start point, given in hh:mm:ss. For the x-labelling I don't care about the seconds, hence I use a hh:mm format. I know that this is not a common date/time format. In Excel I can specify [h]:mm as my formatting, in which case the hours keep incrementing beyond 24. I was just wondering if gnuplot has a similar functionality. Thanks, Armin http://www.nabble.com/file/p19994043/test.png http://www.nabble.com/file/p19994043/test.dat test.dat Hans-Bernhard Bröker-2 wrote: > > > You forgot to show your timefmt setting, but it's highly doubtful this > will do anywhere near what you think it does. > > -- View this message in context: http://www.nabble.com/Plotting-a-time-series-%28elapsed-time%29-with-time-values-%3E-24-hours-tp19975946p19994043.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2008-10-15 15:14:01
|
> I know that this is not a common date/time format.
> In Excel I can specify [h]:mm as my formatting, in
> which case the hours keep incrementing beyond 24.
> I was just wondering if gnuplot has a similar functionality.
gnuplot uses the 'strftime' function from some C library,
and there are no 'accumulated' hours.
the easiest way to get ticslabels from '00:00' to '60:00'
is to define the xticslabels explicitly:
set xtics ("00:00" 0, "06:00" 6*60*60, "12:00" 12*60*60, "18:00" 18*60*60,
"24:00" 24*60*60, "30:00" 30*60*60, "36:00" 36*60*60, "42:00" 42*60*60,
"48:00" 48*60*60, "54:00" 54*60*60, "60:00" 60*60*60)
an explanation: your data start at '00:00:00', that means at 00:00
of the first day of the epoch (since you don't give a date), and
that's second '0'.
in the 'set xtics' command you can give the ticslabel position as
a date string or as an integer representing the number of seconds.
--
View this message in context: http://www.nabble.com/Plotting-a-time-series-%28elapsed-time%29-with-time-values-%3E-24-hours-tp19975946p19995644.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: Thomas S. <t.s...@fz...> - 2008-10-15 16:15:54
|
BTW, most of your time values in the datafile, e.g. '59:59:29', are far from being valid times! '23:59:59' is the maximum value. values larger than '23:59:59' are accepted only because instead of using the standard C function 'strptime' gnuplot has its own one which fills the 'tm' structure and then calls 'mktime' which fixes the wrong hour values. -- View this message in context: http://www.nabble.com/Plotting-a-time-series-%28elapsed-time%29-with-time-values-%3E-24-hours-tp19975946p19996406.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Armin A. <aar...@nd...> - 2008-10-15 16:38:52
|
Thomas Sefzick wrote: > > BTW, most of your time values in the datafile, e.g. '59:59:29', are far > from being valid times! > '23:59:59' is the maximum value. > Thanks Thomas, I think your suggestion with the explicit setting of xtics works well. To be honest I'm not very familiar with "proper" time formats. It worked in Excel so I assumed it's okay. However, since I do generate the input datafile myself I could change to another format. Do you have any suggestions of a better way of doing this? I want to label the time axis in elapsed hours in a reasonably common format. I think "24:00" is more intuitive than "24.0" or "24". -- View this message in context: http://www.nabble.com/Plotting-a-time-series-%28elapsed-time%29-with-time-values-%3E-24-hours-tp19975946p19996824.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2008-10-15 18:22:30
|
> However, since I do generate the input datafile myself > I could change to another format. > Do you have any suggestions of a better way of doing this? > I want to label the time axis in elapsed hours in a reasonably > common format. > I think "24:00" is more intuitive than "24.0" or "24". you could write the time values as hours in floating point format: e.g. '59.99139' instead of '59:59:29' and then plot with: set format x "%.0f:00" set xtics 6 plot 'test.dat' w l -- View this message in context: http://www.nabble.com/Plotting-a-time-series-%28elapsed-time%29-with-time-values-%3E-24-hours-tp19975946p19999320.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |