The LABEL_DATE function can be used, in conjunction with the [XYZ]TICKFORMAT keyword to IDL plotting routines, to easily label axes with dates.
This routine is written in the IDL language. Its source code can be found in the file
label_date.pro
in the
lib
subdirectory of the IDL distribution.
LABEL_DATE has no explicit inputs. When called from the plotting routines, the input parameters are ( Axis, Index, Value )
Set this keyword to a format string that can contain any of the following variables:
For example,
'%M %D, %Y'
results in labels of the form
DEC 11, 1993
.
'%M %2Y'
yields
DEC 93
.
'%D-%M'
yields
11-DEC
.
'%D/%N/%Y'
yields
11/12/1993
.
'%M!C%Y'
yields
DEC
on the top line,
1993
on the bottom (!C is the newline graphics command).
The following commands create a sample plot that has a date axis from Jan 1, 1993 to July 12, 1994:
start_date = JULDAY(1, 1, 1993)
end_date = JULDAY(7, 12, 1994)
dummy = LABEL_DATE(DATE_FORMAT = '%N/%D'); Simple mm/dd
x = FINDGEN(end_date+1 - start_date) + start_date
;
Time axis
PLOT, x, sqrt(x), XTICKFORMAT = 'LABEL_DATE', XSTYLE=1
;
Plot with X axis style set to exact.
[XYZ]TICKFORMAT keyword