<html lang="en"> <head> <title>Managing Default Properties - Untitled</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Untitled"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Advanced-Plotting.html#Advanced-Plotting" title="Advanced Plotting"> <link rel="prev" href="Graphics-Object-Properties.html#Graphics-Object-Properties" title="Graphics Object Properties"> <link rel="next" href="Colors.html#Colors" title="Colors"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Managing-Default-Properties"></a> <p> Next: <a rel="next" accesskey="n" href="Colors.html#Colors">Colors</a>, Previous: <a rel="previous" accesskey="p" href="Graphics-Object-Properties.html#Graphics-Object-Properties">Graphics Object Properties</a>, Up: <a rel="up" accesskey="u" href="Advanced-Plotting.html#Advanced-Plotting">Advanced Plotting</a> <hr> </div> <h4 class="subsection">15.2.3 Managing Default Properties</h4> <p><a name="index-default-graphics-properties-1208"></a><a name="index-graphics-properties_002c-default-1209"></a> Object properties have two classes of default values, <dfn>factory defaults</dfn> (the initial values) and <dfn>user-defined defaults</dfn>, which may override the factory defaults. <p>Although default values may be set for any object, they are set in parent objects and apply to child objects. For example, <pre class="example"> set (0, "defaultlinecolor", "green"); </pre> <p class="noindent">sets the default line color for all objects. The rule for constructing the property name to set a default value is <pre class="example"> default + <var>object-type</var> + <var>property-name</var> </pre> <p>This rule can lead to some strange looking names, for example <code>defaultlinelinewidth"</code> specifies the default <code>linewidth</code> property for <code>line</code> objects. <p>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, <pre class="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)); </pre> <p class="noindent">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. <p>To remove a user-defined default setting, set the default property to the value <code>"remove"</code>. For example, <pre class="example"> set (gca (), "defaultlinecolor", "remove"); </pre> <p class="noindent">removes the user-defined default line color setting from the current axes object. <p>Getting the <code>"default"</code> property of an object returns a list of user-defined defaults set for the object. For example, <pre class="example"> get (gca (), "default"); </pre> <p class="noindent">returns a list of user-defined default values for the current axes object. <p>Factory default values are stored in the root figure object. The command <pre class="example"> get (0, "factory"); </pre> <p class="noindent">returns a list of factory defaults. </body></html>