Setting gca LinestyleOrder but not color order

10 views (last 30 days)
I notice that when I try to set the axis line style order without setting the color order, the change doesn't seem to take. For instance the following example code, everything workes as expected if run as is, but if I comment out the set(gca,'ColorOrder',...) line the linestyleorder property seems to have no effect. Does anyone know why this is?
clf
set(gca, 'ColorOrder', [0 0 0; 0.5 0.5 0.5]);
set(gca, 'LineStyleOrder', {'-', ':', '--', '-.', '--', '*', '.'}); % different line styles
hold all
for i = 1:6
plot( rand( 1, 10 ) );
end

Accepted Answer

Mike Garrity
Mike Garrity on 19 Mar 2015
It doesn't move to the next entry in the LineStyleOrder until it's completed a lap of the ColorOrder. Since you are creating 6 plots and the default ColorOrder has 7 entries, you haven't reached the point where it changes the LineStyle. When you set the ColorOrder, you're setting it to an array which has fewer than 6 entries, so you do increment the LineStyle.
Does that make sense?

More Answers (0)

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!