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 (groot, "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 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 (groot, "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
By default, high level plotting functions such as
plot reset and
redefine axes properties independently from the defaults. An example of such
property is the axes
box property: it is set
on by high level 2-D
graphics functions regardless of the property
hold function to prevent this behavior:
set (groot, "defaultaxesbox", "off"); subplot (2, 1, 1); plot (1:10) title ("Box is on anyway") subplot (2, 1, 2); hold on plot (1:10) title ("Box is off")
Reset the properties of the graphic object h to their default values.
For figures, the properties
"paperunits" are not affected.
For axes, the properties
The input h may also be a vector of graphic handles in which case each individual object will be reset.
See also: cla, clf, newplot.
"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 (groot, "factory");
returns a list of factory defaults.