|
From: Ethan M. <eam...@gm...> - 2015-10-21 19:25:04
|
On Wed, Oct 21, 2015 at 2:42 AM, <gn...@ze...> wrote:
> Hi Gnuplot-info,
>
> I'm trying to plot data on a relative time scale starting at 0 the input
> is a column of seconds and a column of data.
>
> ---------------------------
> set xdata time
> set timefmt "%s"
>
> plot "-" using 1:2 with lp
> 0 0.0
> 1 0.5
> 2 1.0
> 3 1.5
> EOF
> ---------------------------
>
> can someone explain why I get these results:
I think you are confusing the format of the input data with the format
of the x-axis tics in the final plot. It looks like your input is
just a number (time in seconds I suppose), so no time format is
needed.
This answer is for gnuplot version 5.
Earlier versions had somewhat different options available for handling times.
1) If you want time-in-seconds for both input and output then there is
no need for any special handling, time formats, or any of that.
Seconds are seconds - just some number.
2) If the input is time-in-seconds but the output is some clock time
(hours:minutes:seconds) then you want the following. Notice there is
no "set xdata time".
set xtics time format "%H:%M:%S"
plot '-' using 1:2 with lp
3) If you want a relative time rather than a clock time, then you want
a different format that is new in gnuplot 5. This one will not wrap
at 24hrs and also allows for negative values of relative time. See
"help time_specifiers". Also see the 3rd plot in the demo
http://gnuplot.sourceforge.net/demo_5.0/timedat.html
set xtics time format "%tH:%tM:%tS"
plot '-' using 1:2 with lp
Ethan
|