<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

ToBeReviewed/PLOTS/LABEL/

label_date.pro

This function labels axes with dates and times.

toplabel_date Plotting

result = label_date(axis, index, x, DATE_FORMAT=DATE_FORMAT, MONTHS=MONTHS, OFFSET=OFFSET, _EXTRA=_EXTRA)

Parameters

axis        in required

index        in required

x        in required

Keywords

DATE_FORMAT       

a format string which may contain the following: %M for month (3 character abbr) %N for month (2 digit abbr) %D for day of month, %Y for 4 digit year. %Z for last two digits of year. For time: %H for Hours, 2 digits. %I for Minutes, 2 digits. %S for Seconds, 2 digits. %% is %. Other characters are passed directly thru. For example, '%M %D, %Y' prints 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 new line graphic command).

MONTHS       

The names of the months, a twelve element string array. If omitted, use Jan, Feb, ..., Dec.

OFFSET       

An optional starting offset of the plot. Unfortunately, single precision floating point is not accurate enough to properly represent Julian times. This offset, which may be double precision, contains an offset that is added to all x values, before conversion to Julian date and time.

_EXTRA       

Examples

For example, to plot 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.) Example with times: For example, to plot from 3PM, Jan 1, 1993, to 5AM, Jan 3, 1993: Start_date = Julday(1,1,1993) ;Also starting offset Start_time = (3+12)/24. ;Starting_time less offset End_time = (Julday(1,3,1993) - Start_date) + 5./24. ;Ending ;date/time - offset, note that the order of operations is ; important to avoid loss of precision. Dummy = LABEL_DATE(DATE_FORMAT='%D %M!C%H:%I', $ offset=Start_date) ;MMM NN HH:MM format x = findgen(20) * (End_time - Start_time) / 19 + start_time ;Time axis PLOT, x, sqrt(x), XTICKFORMAT = 'LABEL_DATE', XSTYLE=1

Version history

Version

$Id: label_date.pro 157 2006-08-21 09:01:50Z navarro $

History

DMS, RSI. April, 1993. Written. DMS, RSI. March, 1997. Added Time format. Copyright (c) 1993-1998, Research Systems, Inc. All rights reserved. Unauthorized reproduction prohibited.

Known issues

Restrictions

Only one date axis may be simultaneously active.

Other attributes

Uses routines

LABEL_DATE_COM.

Common blocks used

label_date_com

Statistics

McCabe cyclic 17
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.