PRO EUTPLOT,X0, Y, Z, XST0, unc=unc, width=width,      $
        xerr=xerr,yerr=yerr,_extra=extra

on_error,2          ; Return to caller if there is a problem
COMMON UTCOMMON, UTBASE, UTSTART, UTEND, xst_plot

err_entered=exist(xerr) or exist(yerr)
if n_params() lt 3 then begin
 if not err_entered then begin
  message, 'Must supply time,low,high arguments',/cont
  return
 endif
endif

if (keyword_set(unc)) then begin ;jmm, 12-feb-95, allow Z to be a scalar
   if (n_elements(X0) lt 2) or (n_elements(Y) lt 2) then $
     message, 'Check that X0, Y are vectors of length ge 2'
   if (n_elements(z) ne n_elements(y) and (size(z))(0) ne 0) THEN $
     message, 'Z must have the same number of elements as Y or be a scalar'
endif else begin
   if not err_entered then begin
    if (n_elements(X0) lt 2) or (n_elements(Y) lt 2) or (n_elements(Z) lt 2) then begin
     message,'Check that X0, Y, Z are vectors of length ge 2',/cont
     return
    endif
   endif
endelse

if (n_elements(xst0) ne 0) then begin
    ex2int, anytim2ex(xst0), xst_msod, xst_ds79
    xst = [xst_msod, xst_ds79]
    off = int2secarr(xst, xst_plot)
    off = off(0)    ;convert to scalar
end else begin
    xst = xst_plot  ;use the value that was used for UTPLOT
    off = 0
end

siz = size(x0)
typ = siz( siz(0)+1 )
x   = anytim(x0, /ints)     ;-- this allows all SSW time formats! (RAS added)

if (typ eq 8 or siz(0) eq 2 or typ eq 7) then x = int2secarr(x, xst) else x = x0 + off ;jmm, 29-mar-95


;if keyword_set(unc) then       $
;   errplot,x,y-z,y+z,width=width else  $   ; User passed in y, unc
;   errplot,x,y,z,width=width           ; User passed in Low, High

;-- call OPLOTERR in a backward compatible way (DMZ added)

if exist(xerr) then begin
 err_x=',xerr' 
 np=n_elements(x)
 if n_elements(xerr) ne np then xerr=replicate(xerr(0),np)
endif else err_x=''

if exist(z) then err_y=',z' else begin
 if exist(yerr) then err_y=',yerr'
endelse

if keyword_set(unc) or err_entered then begin
 if not exist(err_y) then begin
  message,'Y-uncertainties are required',/cont
  return
 endif
 stat='oploterr,x,y'+err_x+err_y+',_extra=extra,hatlength=width'
 s=execute(stat)
endif else begin
 if exist(y) and exist(z) then begin
  errplot,x,y,z,width=width,_extra=extra
 endif
endelse

return & end