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(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 array 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, Chart Line Properties, Text Properties, and so on. |
Plot a line and return the chart line object as p
.
Set the Color
property of the line to 'red'
.
p = plot(1:10); set(p,'Color','red')
Create a plot with four lines using random data and return the
four chart line objects as P
. Set the Color
property
for all of the lines to 'red'
.
P = plot(rand(4)); set(P,'Color','red')
Set the value of the LineStyle
property
for four chart line objects each to a different value. Transpose the
value of the cell array so that it has the proper shape.
P = plot(rand(4)); NameArray = {'LineStyle'}; ValueArray = {'-','--',':','-.'}'; set(P,NameArray,ValueArray)
Set the values of the Marker
and Tag
properties
on three different stem series objects to different values. Each row
of the value cell array corresponds to an object in h
and
contains two values, one for the Marker
property
and one for the Tag
property.
x = 0:30; y = [1.5*cos(x); 4*exp(-.1*x).*cos(x); exp(.05*x).*cos(x)]'; S = stem(x,y); NameArray = {'Marker','Tag'}; ValueArray = {'o','Decaying Exponential';... 'square','Growing Exponential';... '*','Steady State'}; set(S,NameArray,ValueArray)