
;+
;  Plot exercise 3 - making histograms.
;    - shows how to use barplot
;    - compare with using plot for the same date.
;    - use dates for X-axis
;-


;
; Create Y-axis (just sine curve) plus background
;
y=sin(findgen(12)/11 *!pi) +1.0

;
; Create a vector of times corresponding to the first of each month for
; the year of 2000.
;
date_time = TIMEGEN(12, UNIT = 'Months', START = JULDAY(1, 1, 2000))

th=2
fs=14

w=window(dim=[800,700])

;
; The key to getting X tickmarks correct is to use xtickvalues.
;
p=barplot(date_time,y,/current, $
          layout=[1,2,1], $
          xtickunits='time', $
          thick=th, $
          xthick=th, $
          ythick=th, $
          font_size=fs, $
          /xstyle, $
          yrange=[0,2.5], $
          /ystyle, $
          xtickvalues=date_time, $
          xminor=0, $
          xticklen=0, $
          yticklen=0.01)

;
; Note using /stairstep rather than /histogram.
;
q=plot(date_time,y,/current, $
       /stairstep, $
       layout=[1,2,2], $
       xtickunits='time', $
       thick=th, $
       xthick=th, $
       ythick=th, $
       font_size=fs, $
       /xstyle, $
       yrange=[0,2.5], $
       /ystyle, $
       xtickvalues=date_time, $
       xminor=0, $
       xticklen=0.02, $
       yticklen=0.01)

p.save,'exercise3.png',resolution=97

END
