Different colors for matlab 2014b error bars
I am drawing error lines and would like to color each error bar a different color to make the graph a little easier to interpret. However, since I am using matlab2014b, everything on the net is outdated as there are no more children in the error line. This is the code I am using:
x=[1 2 3 4]
y=[0.5 0.3 0.45 0.36]
upperbound=y.*0.25
lowerbound=y.*0.15
fig1=figure
e1=errorbar(x,y,lowerbound,upperbound,'x')
If possible, I would like to color the center point as well, thanks in advance.
+3
source to share
1 answer
Perhaps you can draw each error bar separately, for example:
hold on
for k = 1:length(x)
e1 = errorbar(x(k),y(k),lowerbound(k),upperbound(k),'x');
set(e1,'Color',rand(1,3))
set(e1,'MarkerEdgeColor',rand(1,3))
end
For details on how to change line styles, colors, etc., see Error Bar Properties .
+2
source to share