Here is an example program that shows a new graphics plot with the date a long the x-axis. The program is called "date_plotter.pro". The programs reads dates stored in the file "test_dates.txt", which is shown below:
test_dates.txt :
11:00/04/01/2011
11:00/04/02/2011
12:12/04/04/2011
12:00/04/15/2011
10:00/05/01/2011
10:00/06/02/2011
date_plotter.pro:
pro date_plotter
COMPILE_OPT IDL2
array=''
line=''
file=FILE_WHICH('test_dates.txt')
openr, u, file, /get_lun
While NOT EOF(u) Do Begin & $
readf, u, line &
array=[array, line] & $
ENDWHILE
FREE_LUN, u
jul_array=findgen(N_elements(array)-1)
FOR i=1, N_elements(array)-1 DO BEGIN
split1 = strsplit(array[i], '/', /EXTRACT)
split2 = strsplit(split1[0], ':', /EXTRACT)
hour=split2[0]
minute=split2[1]
month=split1[1]
day=split1[2]
year=split1[3]
second=0L
j=JULDAY(month,day,year,hour,minute,second)
jul_array[i-1]=j
print, j
ENDFOR
print, jul_array
data=dindgen(N_elements(array)-1)
date_label=LABEL_DATE(DATE_FORMAT = ['%M %D'])
p=plot(jul_array, data, XTICKFORMAT=['LABEL_DATE'],$
xtickunits=['Day'])
end
|