Pro Errplot_x, y, Low, High, Width = width
;+
; NAME:
;	ERRPLOT_X
; PURPOSE:
;	Overplot error bars over a previously drawn plot.
; CATEGORY:
;	J6 - plotting, graphics, one dimensional.
; CALLING SEQUENCE:
;	ERRPLOT_X, Low, High	;Y axis = point number
;	ERRPLOT_X, Y, Low, High	;to specify abscissae
; INPUTS:
;	Low = vector of lower estimates, = to data - error.
;	High = upper estimate, = to data + error.
; OPTIONAL INPUT PARAMETERS:
;	Y = vector containing abscissae.
; KEYWORD Parameters:
;	Width = width of bars, default = 1% of plot width.
; OUTPUTS:
;	None.
; COMMON BLOCKS:
;	None.
; SIDE EFFECTS:
;	Overplot is produced.
; RESTRICTIONS:
;	Logarithmic restriction removed.
; PROCEDURE:
;	Error bars are drawn for each element.
;	To plot versus a vector of abscissae:
;		PLOT,X,Y		;Plot data.
;		ERRPLOT_Y,Y,X-ERR,X+ERR	;Overplot error estimates.
; MODIFICATION HISTORY:
;	DMS, RSI, June, 1983.
;	Joe Zawodney, LASP, Univ of Colo., March, 1986. Removed logarithmic
;		restriction.
;	DMS, March, 1989.  Modified for Unix IDL.
;	RDB, October 1992. Added NOCLIP=!P.NOCLIP to plot statement
;       ...........................................
;       CRF, November 1995. Hacked errplot to create this errplot_x       
;-
	on_error,2                      ;Return to caller if an error occurs
	if n_params(0) eq 3 then begin	;X specified?
		up = high
		down = low
		yy = y
	   endif else begin	;Only 2 params
		up = y
		down = low
		yy=findgen(n_elements(up)) ;make our own x
	   endelse

	if n_elements(width) eq 0 then width = .01 ;Default width
	width = width/2		;Centered
;
	n = n_elements(up) < n_elements(down) < n_elements(yy) ;# of pnts
	yymin = min(!y.crange)	;X range
	yymax = max(!y.crange)
	xxmax = max(!x.crange)  ;Y range
	xxmin = min(!x.crange)

	if !y.type eq 0 then begin	;Test for x linear
		;Linear in x
		wid =  (yymax - yymin) * width ;bars = .01 of plot wide.
	    endif else begin		;Logarithmic X
		yymax = 10.^yymax
		yymin = 10.^yymin
		wid  = (yymax/yymin)* width  ;bars = .01 of plot wide
	    endelse
;
	for i=0,n-1 do begin	;do each point.
		yyy = yy(i)	;x value
		if (yyy ge yymin) and (yyy le yymax) then begin
			plots,[down(i),down(i),down(i),up(i),up(i),up(i)],[yyy-wid,yyy+wid,yyy,yyy,yyy-wid,yyy+wid],NOCLIP=!P.NOCLIP
			endif
		endfor
	return
end
