Set graphics object properties
set(H,Name,Value)
set(H,NameArray,ValueArray)
set(H,S)
s = set(H)
values = set(H,Name)
Note
Do not use the set
function on Java™ objects
as it will cause a memory leak. For more information, see Access Public and Private Data.
set(H,Name,Value)
specifies
a value for the property Name
on the object identified
by H
. Use single quotes around the property name,
for example, set(H,'Color','red')
. If H
is
a vector of objects, then set
sets the property
for all the objects. If H
is empty (that is, []
), set
does
nothing, but does not return an error or warning.
set(H,NameArray,ValueArray)
specifies
multiple property values using the cell arrays NameArray
and ValueArray
.
To set n
property values on each of m
graphics
objects, specify ValueArray
as an m
-by-n
cell
array, where m = length(H)
and n
is
equal to the number of property names contained in NameArray
.
set(H,S)
specifies multiple
property values using S
, where S
is
a structure whose field names are the object property names and whose
field values are the corresponding property values. MATLAB® ignores
empty structures.
s = set(H)
returns the user-settable properties and
possible values for the object identified by H
. s
is
a structure whose field names are the object's property names and whose field values are
the possible values of the corresponding properties. If you do not specify an output
argument, the MATLAB software displays the information on the screen. H
must be
a single object.
values = set(H,Name)
returns
the possible values for the specified property. If the possible values
are character vectors, set
returns each in a
cell of the cell array values
. For other properties, set
returns
a statement indicating that Name
does not have
a fixed set of property values. If you do not specify an output argument, MATLAB displays
the information on the screen. H
must be a single
object.
Note
For more information about properties you can set, see the property pages for each object, for example, Figure Properties, Axes Properties, Line Properties, Text Properties, and so on.
You can use any combination of property name/property value
pairs, structure arrays, and cell arrays in one call to set
.
Note that if you are setting both the FontSize
and
the FontUnits
properties in one function call,
you must set the FontUnits
property first so
that the MATLAB software can correctly interpret the specified FontSize
.
The same applies to figure and axes units — always set the Units
property
before setting properties whose values you want to be interpreted
in those units. For example,
f = figure('Units','characters','Position',[30 30 120 35]);