MATLAB: Are the legend and errorbar of different colors when using MATLAB 7.0.4(R14SP2)

childrencolordifferenterrorbarhggrouplegendMATLAB

I create an errorbar using the ERRORBAR function and create a legend. If I change the color of the errorbar, the color of the legend does not change and stays the same.

Best Answer

In R14 the legend gets the color for the errorbar from the errorbar
group object. So, instead of setting the color of the lines that are
children of the errorbar group, set the color of the group
directly:
h = errorbar( [0 1],[0 1],[.05,.05],'o-');
set(h,'color','g')
legend('right color')
The plot command and the 'v6' errorbar command do not create hggroup
objects so the legend in those versions gets the color from the lines.