| Credits | Overview | Plotting Styles | Commands | Terminals |
|---|
Times and dates are stored internally as a number of seconds.
Input: Non-numeric time and date values are converted to seconds on input using the format specifier in timefmt. Axis range limits, tic placement, and plot coordinates may be given as quoted dates or times interpreted using timefmt.
Output: Axis tic labels are generated using a separate format specified either by set format or set xtics format. By default the usual numeric format specifiers are expected (set xtics numeric). Other options are geographic coordinates (set xtics geographic), or times or dates (set xtics time).
Note: For backward compatibility with earlier gnuplot versions, the command set xdata time will implicitly also do set xtics time, and set xdata or unset xdata will implicitly reset to set xtics numeric. However you can change this with a later call to set xtics.
Examples:
set xdata time # controls interpretation of input data
set timefmt "%d/%m" # format used to read input data
set xtics timedate # controls interpretation of output format
set xtics format "%b %d" # format used for tic labels
set xrange ["01/12":"06/12"]
set xtics "01/12", 172800, "05/12"
set xdata time
set timefmt "%d/%m"
set xtics format "%b %d" time
set xrange ["01/12":"06/12"]
set xtics ("01/12", "" "03/12", "05/12")
Both of these will produce tics "Dec 1", "Dec 3", and "Dec 5", but in the second example the tic at "Dec 3" will be unlabeled.
If the <start>, <incr>, <end> form is used, <incr> defaults to seconds but an explicit time unit of minutes, hours, days, weeks, months, or years can be appended. The same is true if only an interval <incr> is given.
Examples
set xtics time 5 years # place labeled tics at five year intervals
set xtics "01-Jan-2000", 1 month, "01-Jan-2001"
There is also a special time mode for minor tics. See set mxtics time.