Documentation Center

  • Trial Software
  • Product Updates

Change Default Line Style and Color Orders

You can configure MATLAB® defaults to use line styles instead of colors for multiline plots by setting a value for the axes LineStyleOrder property using a cell array of linespecs. For example, the command


defines three line styles and makes them the default for all plots.

To set the default line color to dark gray, use the statement


See ColorSpec for information on how to specify color as a three-element vector of RGB values.

Now the plot function uses the line styles and colors you have defined as defaults. For example, these statements create a multiline plot.

x  = 0:pi/10:2*pi;
y1 = sin(x);
y2 = sin(x-pi/2);
y3 = sin(x-pi);

The default values persist until you quit MATLAB. To remove default values during your MATLAB session, use the reserved word remove.


See Setting Default Property Values for more information.

Was this topic helpful?