Graphics |
To specify default values, create a string beginning with the word Default
followed by the object type and finally the object property. For example, to specify a default value of 1.5 points for the line LineWidth
property at the level of the current figure, use the statement,
The string, DefaultLineLineWidth
identifies the property as a line property. To specify the figure color, use DefaultFigureColor
. Note that it is meaningful to specify a default figure color only on the root level.
Use get
to determine what default values are currently set on any given object level; for example,
returns all default values set on the current figure.
Setting Properties to the Default
Specifying a property value of '
default
'
sets the property to the first encountered default value defined for that property. For example, these statements result in a green surface EdgeColor
,
set(0,'DefaultSurfaceEdgeColor','k') h = surface(peaks); set(gcf,'DefaultSurfaceEdgeColor','g') set(h,'EdgeColor','default')
Since a default value for surface EdgeColor
exists on the figure level, MATLAB encounters this value first and uses it instead of the default EdgeColor
defined on the root.
Removing Default Values
Specifying a property value of '
remove
'
gets rid of user-defined default values. The statement,
removes the definition of the default Surface EdgeColor
from the root.
Setting Properties to Factory-Defined Values
Specifying a property value of '
factory
'
sets the property to its factory-defined value. (The property descriptions provides access to the factory settings for properties having predefined sets of values.)
For example, these statements set the EdgeColor
of surface h
to black (its factory setting) regardless of what default values you have defined.
Reserved Words
Setting a property value to default
, remove
, or factory
produces the effect described in the previous sections. To set a property to one of these words (e.g., a text or uicontrol String
property set to the word "Default"
), you must precede the word with the backslash character. For example,
Setting Default Property Values | Examples -- Setting Default LineStyles |