[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

16. Time/Date data

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 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 will re-interpret the integer according to timefmt. If you change timefmt, and then show the quantity again, it will be displayed in the new timefmt. For that matter, if you give the deactivation command (like set xdata), the quantity will be shown in its numerical form.

The command set 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 option _must_ be used on the plot or 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.

This section lists the commands acceptable to gnuplot in alphabetical order. Printed versions of this document contain all commands; on-line versions may not be complete. Indeed, on some systems there may be no commands at all listed under this heading.

Note that in most cases unambiguous abbreviations for command names and their options are permissible, i.e., "p f(x) w l" instead of "`plot f(x) with lines`".

In the syntax descriptions, braces ({}) denote optional arguments and a vertical bar (|) separates mutually exclusive choices.

17. cd  
18. call  
19. clear  
20. exit  
21. fit  
22. help  
23. if  
24. load  
25. pause  
26. plot  
27. print  
28. pwd  
29. quit  
30. replot  
31. reread  
32. reset  
33. save  
34. set-show  
35. shell  
36. splot  
37. test  
38. update  


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by root l2-hrz on May, 9 2001 using texi2html