Main Content

How MATLAB Finds Default Values

All graphics object properties have values built into MATLAB®. These values are called factory-defined values. Any property for which you do not specify a value uses the predefined value.

You can also define your own default values. MATLAB uses your default value unless you specify a value for the property when you create the object.

MATLAB searches for a default value beginning with the current object and continuing through the object's ancestors until it finds a user-defined default value or until it reaches the factory-defined value. Therefore, a search for property values is always satisfied.

MATLAB determines the value to use for a given property according to this sequence of steps:

  1. Property default value specified as argument to the plotting function

  2. If object is a line created by a high-level plotting function like plot, the axes ColorOrder and LineStyleOrder definitions override default values defined for the Color or LineStyle properties.

  3. Property default value defined by axes (defaults can be cleared by plotting functions)

  4. Property default value defined by figure

  5. Property default value defined by root

  6. If not default is defined, use factory default value

Setting default values affects only those objects created after you set the default. Existing graphics objects are not affected.