Viewing contents of file '../idllib/iuedac/iuelib/pro/errbar.pro'
;************************************************************************
;+
;*NAME:
; ERRBAR 1 June, 1982 (in file ERRBAR.PRO)
;
;*CLASS:
;
;*CATEGORY:
; PROCEDURE TYPE: Graphics
;
;*PURPOSE:
; To plot error bars at specified data coordinates.
; Single or multiple error bars may be plotted at the same
; time.
;
;*CALLING SEQUENCE:
; ERRBAR,X,Y,DELTAX,DELTAY
;
;*PARAMETERS:
; X (REQ) (I) (0 1) (I L F D)
; An array or scalar variable containing the X coordinates of
; the data.
;
; Y (REQ) (I) (0 1) (I L F D)
; An array or scalar variable containing the Y coordinates of
; the data.
;
; DELTAX (REQ) (I) (0 1) (I L F D)
; An array or scalar variable containing the error for each X
; point.
;
; DELTAY (REQ) (I) (0 1) (I L F D)
; An array or scalar variable containing the error for each Y
; point.
;
;*INTERACTIVE INPUT:
; The error bars are printed on the terminal screen
;
;*FILES USED:
;
;*SYSTEM VARIABLES USED:
;
;*SUBROUTINES CALLED:
; IUER_SOFTDISK:PARCHECK
;
;*SIDE EFFECTS:
;
;*RESTRICTIONS:
;
;*NOTES:
; A plot must be made before calling ERRBAR to insure that
; the plotting parameters are set.
;
; If the input parameters are not arrays of the same length
; an error message results.
;
;*PROCEDURE:
;
;*INF_1:
;
;*EXAMPLES:
;
;*MODIFICATION HISTORY:
; Programmer: D. Lear
; 12-84 CAG Add option to plot single error bar if desired
; 8-26-86 CAG move IDL prompt at end of execution out of
; middle of plot (URP #197)
; 10-7-86 RWT add compile of GFBOUT
; 12-29-86 RWT add VAX mods: !ACMD for !OUT, vector subscripts
; modify indirect compilations
; 3-14-87 RWT add PARCHECK
; 6-11-87 strip device dependent code, and enhance documentation
; 6-9-88 RWT add procedure call listing
; 2-17-93 RWT add to IDL version 2 experimental library
;-
;************************************************************************
PRO ERRBAR,X,Y,DELTAX,DELTAY
;
NPAR = N_PARAMS(0)
IF NPAR EQ 0 THEN BEGIN
PRINT,' ERRBAR,X,Y,DELTAX,DELTAY'
RETALL & END
PARCHECK,NPAR,4,'ERRBAR'
;
; find out how many error bars are to be drawn
;
NEL=N_ELEMENTS(X)
;
; replicate the error bar data if only a single error bar is to be
; drawn - this is to avoid problems with IDL vectors
;
IF NEL EQ 1 THEN BEGIN
XX=FLTARR(2) & YY=XX & DDX=XX & DDY=XX
XX(*)=X & YY(*)=Y & DDX(*)=DELTAX & DDY(*)=DELTAY
X=XX & Y=YY & DELTAX=DDX & DELTAY=DDY
NEL=NEL+1
END
;
; plot each error bar one at a time
;
FOR I=0,NEL-1 DO BEGIN
;
; Do the x-axis error bars, if any
;
DX=DELTAX(I)
DY=DELTAY(I)
IF (DX NE 0) THEN BEGIN
EX=FLTARR(2)
EX(0)=X(I)+DX
EX(1)=X(I)-DX
YP=FLTARR(2)
YP(0)=Y(I)
YP(1)=Y(I)
OPLOT,EX,YP
ENDIF
;
; do the y-axis error bars, if any
;
IF (DY NE 0) THEN BEGIN
EY=FLTARR(2)
EY(0)=Y(I)+DY
EY(1)=Y(I)-DY
XP=FLTARR(2)
XP(0)=X(I)
XP(1)=X(I)
OPLOT,XP,EY
ENDIF
END
RETURN
END