Setting gca LinestyleOrder but not color order
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jacob Cram
le 19 Mar 2015
Réponse apportée : Mike Garrity
le 19 Mar 2015
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
0 commentaires
Réponse acceptée
Mike Garrity
le 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?
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Object Properties dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!