Graphics Programs Reference
In-Depth Information
31.2 Default Object Properties
Every graphical object has a set of default property values, so that you
are not obliged to spend time thinking about every detail of every graph-
ical object you draw. For example, when you type plot(1:10) you do
not necessarily want to think about how thick the line should be, where
the tick marks should go, how long the tick marks should be, what colour
the axes should be, what matlab should do when you click on the line,
etc.
When matlab creates a graphical object it searches through the
successive ancestors (parent, grandparent, etc.) until it either finds a
default value defined by the user or a factory-set value. For example,
you could define your own default line width for a figure, in which case
all new lines drawn in any axes in that figure would have the new line
width. Or you could set a default line width in an axes object: such a
default would affect lines drawn in that set of axes, but lines drawn in
another set of axes would have their widths set by a search through their
own, different set of ancestors.
To get a list of factory-defined settings, issue the command
get(0,'factory') . You cannot change the factory settings, but you
can change the default settings. To get a single factory-defined set-
ting, use the get command, giving it the property name starting with
factory , followed by the name of the graphical object ( figure , axes ,
etc.), followed by the name of the property. For example, the factory
paper type used for printing figures is
>> get(0,'factoryfigurepapertype')
ans =
usletter
Factory settings are not necessarily those that will be used; they may be
over-ridden by setting a default value. Default values may be changed
for your matlab installation in either the matlabrc.m file or in your
personal startup.m file.
To get a list of default settings, issue the command get(Handle,
'Default') , where Handle is the handle of the object you are interested
in. Setting a default value at the Root level ( Handle = 0 ) will affect all
objects of that type.
To set a default value you use the set command, giving it the handle
of the object whose children (grandchildren, etc.) you want affected. You
create a default property name by creating a three-part string:
1. Start with the word Default ;
2. Add the name of the object you want affected (for example, Line ,
Surface , Text );
Search WWH ::




Custom Search