Define Default Line Styles

This example shows how to set default line styles.

The plot function cycles through the colors defined by the axes ColorOrder property when displaying multiline plots. If you define more than one value for the axes LineStyleOrder property, plot increments the line style after each cycle through the colors.

This example sets default values for axes objects on the root level:

set(groot,'DefaultAxesColorOrder',[0 0 0],...

Now, whenever you call plot, it uses black for all data plotted because the axes ColorOrder contains only one color, but it cycles through the line styles defined for LineStyleOrder.

Z = peaks;
x = 1:length(Z);
y = Z(4:7,:);

Was this topic helpful?