Graphics Previous page   Next Page

Setting Default Property Values

All object properties have values built into MATLAB (i.e., factory-defined values). You can also define your own default values at any point in the object hierarchy.

Note that you cannot define default values for plot objects.

How MATLAB Searches for Default Values

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.

The closer to the root of the hierarchy you define the default, the broader its scope. If you specify a default value for line objects on the root level, MATLAB uses that value for all lines (because the root is at the top of the hierarchy). If you specify a default value for line objects on the axes level, then MATLAB uses that value for line objects drawn only in that axes.

If you define default values on more than one level, the value defined on the closest ancestor takes precedence because MATLAB terminates the search as soon as it finds a value.

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

This diagram shows the steps MATLAB follows in determining the value of a graphics object property.


Previous page  Factory-Defined Property Values Defining Default Values Next page

© 1994-2005 The MathWorks, Inc.