MATLAB: Plotting 3 sets of data with error bars in different colors

barcolorerrorerrorbarfigureplotscatter

I have three sets of data, each point has its own error, I want to plot all of them on the same figure with different sets having different colors. I don't want the curve, just the points and bars.
My attempt:
errorbar(x,y1,ey1,'.k')
hold on
errorbar(x,y2,ey2,'.k')
errorbar(x,y3,ey3,'.k')
That's what I want but with each set being in a different color eg. y1 black, y2 red, y3 blue. Thanks

Best Answer

You’re almost there! You simply have to define each error bar with the colour you want:
errorbar(x,y1,ey1,'.k')
hold on
errorbar(x,y2,ey2,'.r')
errorbar(x,y3,ey3,'.b')
hold off
See if that does what you want.