set
Set graphics object properties
Syntax
Description
set(
sets
properties for the specified graphics object h
,Name,Value
)h
using one or more
name-value arguments. If h
is a vector of objects, then
set
sets the properties for all the objects in
h
. If h
is empty ([ ]), set
does nothing and does not return an error or warning.
For more information about properties that you can set, see the property pages for each object, for example, Figure Properties, Axes Properties, Line Properties, and Text Properties.
set(
changes the default value of the specified property and object type for the specified
graphics object h
,defaultTypeProperty,defaultValue
)h
using one or more pairs of property names and values.
defaultTypeProperty
is the word default
concatenated with the object type (for example, Figure
) and the property
name (for example, Color
) in quotes. For example,
set(groot,"defaultFigureColor","red")
changes the default value of the
Color
property of Figure
objects to
red
for the graphics root object, groot
.
set(
sets multiple properties for the specified graphics object h
,NameArray
,ValueArray
)h
.
If
h
is a scalar object, specifyNameArray
andValueArray
as 1-by-n cell arrays containing one or more property names or values, where n is the number of properties being set.If
h
is a vector of objects, to set a different property value for each object inh
, specifyValueArray
as an m-by-n cell array, where m is the number of elements inh
and n is the number of property names contained inNameArray
.
returns the possible values for the specified property. If the possible values are character
vectors or strings, v
= set(h
,propertyName
)set
returns a cell array containing the values. For
other properties that do not have a fixed set of values, set
returns an
empty cell array. h
must be a single object. This syntax does not change
the properties of h
.
If v
is not specified, set
displays the
possible values in the Command Window.
Examples
Input Arguments
Output Arguments
Tips
When setting the
FontSize
andFontUnits
properties in the sameset
statement, specify theFontUnits
property first. This order allows theset
function to interpret the specifiedFontSize
as intended. Similarly, when setting figure and axes units, set theUnits
property before setting additional properties whose values are calculated using the specified units. For example, this command sets theUnits
property before setting thePosition
property, whose measurements are in units specified by theUnits
property.f = figure; set(f,"Units","characters","Position",[30 30 120 35]);
Version History
Introduced before R2006a