OPLOTERROR
Name
OPLOTERROR
Purpose
Over-plot data points with accompanying X or Y error bars.
Explanation
For use instead of PLOTERROR when the plotting system has already been
defined.
Calling Sequence
oploterror, [ x,] y, [xerr], yerr,
[ /NOHAT, HATLENGTH= , ERRTHICK =, ERRSTYLE=, ERRCOLOR =,
/LOBAR, /HIBAR, NSKIP = , NSUM = , /ADDCMD, ... OPLOT keywords ]
Inputs
X = array of abcissae, any datatype except string
Y = array of Y values, any datatype except string
XERR = array of error bar values (along X)
YERR = array of error bar values (along Y)
Optional Input Keyword Parameters
/ADDCMD = Set this keyword if you want to add this command to
a cgWindow.
/NOHAT = if specified and non-zero, the error bars are drawn
without hats.
HATLENGTH = the length of the hat lines used to cap the error bars.
Defaults to !D.X_VSIZE / 100).
ERRTHICK = the thickness of the error bar lines. Defaults to the
THICK plotting keyword.
ERRSTYLE = the line style to use when drawing the error bars. Uses
the same codes as LINESTYLE.
ERRCOLOR = String (e.g. 'red') or scalar integer (0 - !D.N_TABLE)
specifying the color to use for the error bars. See CGCOLOR()
for a list of possible color names. See
http://www.idlcoyote.com/cg_tips/legcolor.php
for a warning about the use of indexed color
NSKIP = Positive Integer specifying the error bars to be plotted.
For example, if NSKIP = 2 then every other error bar is
plotted; if NSKIP=3 then every third error bar is plotted.
Default is to plot every error bar (NSKIP = 1)
NSUM = Number of points to average over before plotting, default =
!P.NSUM The errors are also averaged, and then divided by
sqrt(NSUM). This approximation is meaningful only when the
neighboring error bars have similar sizes.
/LOBAR = if specified and non-zero, will draw only the -ERR error bars.
/HIBAR = if specified and non-zero, will draw only the +ERR error bars.
If neither LOBAR or HIBAR are set _or_ if both are set,
you will get both error bars. Just specify one if you
only want one set.
Any valid keywords to the OPLOT command (e.g. PSYM, YRANGE) are also
accepted by OPLOTERROR via the _EXTRA facility.
Notes
If only two parameters are input, they are taken as Y and YERR. If only
three parameters are input, they will be taken as X, Y and YERR,
respectively.
Example
Suppose one has X and Y vectors with associated errors XERR and YERR
and that a plotting system has already been defined:
(1) Overplot Y vs. X with both X and Y errors and no lines connecting
the points
IDL> oploterror, x, y, xerr, yerr, psym=3
(2) Like (1) but overplot only the Y errors bars and omits "hats"
IDL> oploterror, x, y, yerr, psym=3, /NOHAT
(3) Like (2) but suppose one has a positive error vector YERR1, and
a negative error vector YERR2 (asymmetric error bars)
IDL> oploterror, x, y, yerr1, psym=3, /NOHAT,/HIBAR
IDL> oploterror, x, y, yerr2, psym=3, /NOHAT,/LOBAR
Procedure
A plot of X versus Y with error bars drawn from Y - YERR to Y + YERR
and optionally from X - XERR to X + XERR is written to the output device
WARNING:
This an enhanced version of the procedure OPLOTERR in the standard RSI
library. It was renamed to OPLOTERROR in June 1998 in the IDL
Astronomy library.
Modification History
Adapted from the most recent version of PLOTERR. M. R. Greason,
Hughes STX, 11 August 1992.
Added COLOR keyword option to error bars W. Landsman November 1993
Add ERRCOLOR, use _EXTRA keyword, W. Landsman, July 1995
Remove spurious call to PLOT_KEYWORDS W. Landsman, August 1995
OPLOT more than 32767 error bars W. Landsman, Feb 1996
Added NSKIP keyword W. Landsman, Dec 1996
Added HIBAR and LOBAR keywords, M. Buie, Lowell Obs., Feb 1998
Rename to OPLOTERROR W. Landsman June 1998
Ignore !P.PSYM when drawing error bars W. Landsman Jan 1999
Handle NSUM keyword correctly W. Landsman Aug 1999
Check limits for logarithmic axes W. Landsman Nov. 1999
Work in the presence of NAN values W. Landsman Dec 2000
Improve logic when NSUM or !P.NSUM is set W. Landsman Jan 2001
Remove NSUM keyword from PLOTS call W. Landsman March 2001
Only draw error bars with in XRANGE (for speed) W. Landsman Jan 2002
Fix Jan 2002 update to work with log plots W. Landsman Jun 2002
Added STRICT_EXTRA keyword W. Landsman July 2005
W. Landsman Fixed case of logarithmic axes reversed Mar 2009
Update for Coyote Graphics W. Landsman Feb. 2011
Hats were not being plotted by default W. Landsman Apr 2011