MATLAB: How to draw an “error bar” between two points on a scatter plot

error barsscatter plotxy plot

Hi All,
I am plotting gps corrdinates on an x/y scatter plot. Based on some statistics I ran, the gps corrdinates could be slighty off resulting in the posibility of the current gps location being slighty ahead or behind the estimated location.
I would like to show this error on the scatter plot by plotting an "error bar" of sorts.
My question is:
How would I go about plotting a line between points (x1, y1) and (x2, y2) that looks like an error bar?
Thanks,
Zach

Best Answer

I think you might be able to get something pretty close to what you want using the doublearrow annotation. (There is a property governing what the arrowheads look like; I don't think any are a truly flat end like an errorbar, but maybe you don't care.)
Failing that, you could build it completely from scratch using the line primitive.
Related Question