manpagez: man pages & more
info gnuplot
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.21.68 timefmt

This command applies to timeseries where data are composed of dates/times. It has no meaning unless the command `set xdata time` is given also.

Syntax:

 
      set timefmt "<format string>"
      show timefmt

The string argument tells `gnuplot` how to read timedata from the datafile. The valid formats are:

 
      Format       Explanation
      %d           day of the month, 1--31
      %m           month of the year, 1--12
      %y           year, 0--99
      %Y           year, 4-digit
      %j           day of the year, 1--365
      %H           hour, 0--24
      %M           minute, 0--60
      %s           seconds since the Unix epoch (1970-01-01, 00:00 UTC)
      %S           second, 0--60
      %b           three-character abbreviation of the name of the month
      %B           name of the month

Any character is allowed in the string, but must match exactly. \t (tab) is recognized. Backslash-octals (\nnn) are converted to char. If there is no separating character between the time/date elements, then %d, %m, %y, %H, %M and %S read two digits each, %Y reads four digits and %j reads three digits. %b requires three characters, and %B requires as many as it needs.

Spaces are treated slightly differently. A space in the string stands for zero or more whitespace characters in the file. That is, "%H %M" can be used to read "1220" and "12 20" as well as "12 20".

Each set of non-blank characters in the timedata counts as one column in the `using n:n` specification. Thus `11:11 25/12/76 21.0` consists of three columns. To avoid confusion, `gnuplot` requires that you provide a complete using specification if your file contains timedata.

Since `gnuplot` cannot read non-numerical text, if the date format includes the day or month in words, the format string must exclude this text. But it can still be printed with the "%a", "%A", "%b", or "%B" specifier: see `set format` for more details about these and other options for printing timedata. (`gnuplot` will determine the proper month and weekday from the numerical values.)

See also xdata and `Time/date` for more information.

Example:

 
      set timefmt "%d/%m/%Y\t%H:%M"

tells `gnuplot` to read date and time separated by tab. (But look closely at your data—what began as a tab may have been converted to spaces somewhere along the line; the format string must match what is actually in the file.) See also time data demo.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2025
Individual documents may contain additional copyright information.