MATLAB: Plotting X-X and Y-Y (a cross on a point)

plotplottingplotxploty

Hey guys,
So I have these 6 values of a certain quantity. When I do a scatter plot, I get three points.
Now each of these 6 values have 2 confidence interval bounds for them. I want to plot the bounds as a cross passing through the point. Like error bars in X and Y.
So let's say there's a value x1 and one y1, each for the same condition. I scatter them as
plot(x1,y1,'ob')
so I get one point with coordinates (x1,y1).
for x1, I have confidence bounds [c1,c2] and for y1 I have [c3,c4]. c1 and c2 should be plotted both on X and a line should connect them and c3,c4 should both be on Y and a line should connect them. If my bootstrapping is robust, then (x1,y1) will be the center of this cross of (c1-c2,c3-c4).
Is there anyway to do it?
Thanks.

Best Answer

x1 = 3;
y1 = 5;
c1 = 2; c2 = 4;
c3 = 4; c4 = 6;
plot(x1,y1,'ob')
hold on
axis([0 7 0 7])
hold on
plot([c1 c2],[y1 y1],'k')
plot([x1 x1],[c3 c4],'k')
Related Question