pro plot_bar_lines,xx,yy,_extra=plot_keywords
;+
;NAME:
;  plot_bar_lines
;PURPOSE:
;  Produce a line plot using histogram mode and filling
;  in the bins with vertical bars.
;CALLING SEQUENCE:
;  plot_bar_lines,x,y
;
;  This routine takes all allowed plot proceedure keywords
;HISTORY:
;  11-Jan-96, J. R. Lemen and Gan Wei Qun, written
;-

ii =sort(xx)		; Make sure the data is monotonically increasing

plot,xx(ii),yy(ii),psym=10,_extra=plot_keywords
ymin = !y.crange(0)

; The next three lines fixes the end points:

x1 = (xx(ii) + xx(ii(1:*))) / 2. 
x0 = x1(0) - (x1(1)-x1(0))
x2 = x1(n_elements(x1)-1) + (x1(n_elements(x1)-1)-x1(n_elements(x1)-2))

x1 = [x0,x1,x2]
y1 = yy(ii) < yy(ii(1:*))
y1 = [y1(0),y1,y1(n_elements(y1)-1)]


for i=0,n_elements(x1)-1 do oplot,x1(i)*[1,1],[!y.crange(0),y1(i)]

; Finish drawing the endpoints:
oplot,x1(0:1),y1(1)*[1,1]
oplot,x1(n_elements(x1)-2:*),y1(n_elements(y1)-2)*[1,1]

end
