Fanning Software Consulting

Error Bars in Either Direction

QUESTION: I found the IDL routines PLOTERR and ERRPLOT, but these seem to draw error bars only in the Y direction. I want error bars in both the X and Y directions. How can I do this in IDL?

ANSWER: You are probably out of luck here, given what goes in the IDL distribution. But others have run up against this problem, too. Check out the routines PlotErrorand OplotErr in the NASA Astronomy Library. These routines have modified the standard IDL routines to allow error bars in either direction. Moreover, the routines have additional options, such as NAN value recogntion, plotting only every nth error bar, and the NSum keyword that make them even more useful.

Error bars can also be created on plots using the ERR_* keywords available on the cgPlot command. You can find IDL code and see an example of this in the Errorbar_Plot example in the Coyote Plot Gallery.

A plot with the Coyote Library routine cgErrPlot.

[Return to IDL Programming Tips]