Graphics    

Setting Property Values

You can change the properties of an existing object using the set function and the handle returned by the creating function. For example, this statement moves the y-axis to the right side of the plot on the current axes.

If the handle argument is a vector, MATLAB sets the specified value on all identified objects.

You can specify property names and property values using structure arrays or cell arrays. This can be useful if you want to set the same properties on a number of objects. For example, you can define a structure to set axes properties appropriately to display a particular graph.

To set these values on the current axes, type

Listing Possible Values

You can use set to display the possible values for many properties without actually assigning a new value. For example, this statement obtains the values you can specify for line object markers.

MATLAB returns a list of values for the Marker property for the type of object specified by obj_handle. Braces indicate the default value.

To see a list of all settable properties along with possible values of properties that accept string values, use set with just an object handle.

For example, for a surface object, MATLAB returns

If you assign the output of the set function to a variable, MATLAB returns the output as a structure array. For example,

The field names in a are the object's property names and the field values are the possible values for the associated property. For example,

returns the possible value for the axes grid line styles. Note that while property names are not case sensitive, MATLAB structure field names are. For example,

returns an error.


  Setting and Querying Property Values Querying Property Values