Object properties have two classes of default values, factory defaults (the initial values) and user-defined defaults, which may override the factory defaults.
Although default values may be set for any object, they are set in
parent objects and apply to child objects, of the specified object type.
For example, setting the default
color property of
"green", for the
root object, will result in all
line objects inheriting the
"green" as the default
set (0, "defaultlinecolor", "green");
sets the default line color for all objects. The rule for constructing the property name to set a default value is
default + object-type + property-name
This rule can lead to some strange looking names, for example
defaultlinelinewidth" specifies the default
The example above used the root figure object, 0, so the default property value will apply to all line objects. However, default values are hierarchical, so defaults set in a figure objects override those set in the root figure object. Likewise, defaults set in axes objects override those set in figure or root figure objects. For example,
subplot (2, 1, 1); set (0, "defaultlinecolor", "red"); set (1, "defaultlinecolor", "green"); set (gca (), "defaultlinecolor", "blue"); line (1:10, rand (1, 10)); subplot (2, 1, 2); line (1:10, rand (1, 10)); figure (2) line (1:10, rand (1, 10));
produces two figures. The line in first subplot window of the first figure is blue because it inherits its color from its parent axes object. The line in the second subplot window of the first figure is green because it inherits its color from its parent figure object. The line in the second figure window is red because it inherits its color from the global root figure parent object.
To remove a user-defined default setting, set the default property to
"remove". For example,
set (gca (), "defaultlinecolor", "remove");
removes the user-defined default line color setting from the current axes
object. To quickly remove all user-defined defaults use the
Remove any defaults set for the handle h. The default figure
"paperunits" and the default axes
"units" are not reset.
See also: cla, clf.
"default" property of an object returns a list of
user-defined defaults set for the object. For example,
get (gca (), "default");
returns a list of user-defined default values for the current axes object.
Factory default values are stored in the root figure object. The command
get (0, "factory");
returns a list of factory defaults.