`gnuplot` (Note:gnuplot ) supports the use of time and/or date information
as input data. This feature is activated by the commands `set xdata time`,
`set ydata time`, etc.
Internally all times and dates are converted to the number of seconds from
the year 2000. The command `set timefmt` (Note:timefmt ) defines the
format for all inputs: data files, ranges, tics, label positions---in short,
anything that accepts a data value must receive it in this format. Since only
one input format can be in force at a given time, all time/date quantities
being input at the same time must be presented in the same format. Thus if
both x and y data in a file are time/date, they must be in the same format.
The conversion to and from seconds assumes Universal Time (which is the same
as Greenwich Standard Time). There is no provision for changing the time
zone or for daylight savings. If all your data refer to the same time zone
(and are all either daylight or standard) you don't need to worry about these
things. But if the absolute time is crucial for your application, you'll
need to convert to UT yourself.
Commands like `show xrange` (Note:xrange ) will re-interpret the integer
according to `timefmt`. If you change `timefmt`, and then `show`
(Note:set-show ) the quantity again, it will be displayed in the new
`timefmt`. For that matter, if you give the deactivation command (like `set
xdata` (Note:xdata )), the quantity will be shown in its numerical form.
The command `set format` (Note:format ) defines the format that will be
used for tic labels, whether or not the specified axis is time/date.
If time/date information is to be plotted from a file, the `using`
(Note:using ) option _must_ be used on the `plot` (Note:plot ) or
`splot` (Note:splot ) command. These commands simply use white space to
separate columns, but white space may be embedded within the time/date
string. If you use tabs as a separator, some trial-and-error may be necessary
to discover how your system treats them.
The following example demonstrates time/date plotting.
Suppose the file "data" contains records like
03/21/95 10:00 6.02e23
This file can be plotted by
set xdata time
set timefmt "%m/%d/%y"
set xrange ["03/21/95":"03/22/95"]
set format x "%m/%d"
set timefmt "%m/%d/%y %H:%M"
plot "data" using 1:3
which will produce xtic labels that look like "03/21".
See the descriptions of each command for more details.