# set

## Purpose

Set object properties.

## Synopsis

    set(h,'PropertyName',PropertyValue,...)
    set(h)
    set(h,'PropertyName')

## Description

Use the `set` function to specify the value of object properties (except those that are read only).

`set(h,'PropertyName',PropertyValue,...)` sets properties for the object with handle `h` (or objects if `h` is a vector). A single call to `set` can specify any number of property name/property value pairs. MATLAB processes a single long call faster than several short ones.

To set default object properties values, concatenate the words `Default`, the object name, and the property name. For example, to set the default axes color for new axes in the current figure, use the statement

    set(gcf,'DefaultAxesColor',[1 1 1])

Since objects check for default property values on parent objects, set the default axes properties in the figure in which you want the value used. Similarly, set default figure properties at the root level.

`set(h)`, where `h` is an object handle, displays a list of all the properties you can set for that object along with the possible values for each property.

`set(h,'PropertyName')` lists the possible values for the specified property.

`set` also accepts the strings `default`, `factory`, and `remove` as property values.

Specifying a value of `default` sets the property to the first encountered default value defined for that property. For example, these statements set the surface's `EdgeColor` property to green:

    h = surf(peaks)
    set(0,'DefaultSurfaceEdgeColor','g')
    set(h,'EdgeColor','default')

If a default value for surface `EdgeColor` existed on the figure or axes level, these statements would instead set the `EdgeColor` of the surface `h` to that default value.

Specifying a value of `factory` sets the property to its factory setting. For example, these statements

    h = surf(peaks)
    set(0,'DefaultSurfaceEdgeColor','g')
    set(h,'EdgeColor','factory')

set the `EdgeColor` of surface `h` to black (its factory setting) regardless of what default values are defined.

The string `remove` gets rid of a default value. The statement

    set(0,'DefaultSurfaceEdgeColor','remove')

removes the definition of the default surface `EdgeColor` on the root. The value for surface `EdgeColor` then reverts to the factory setting.

To use `default`, `factory`, or `remove` as strings in an axis label, for example, as opposed to property values as discussed above, place a backslash before the word:

    set(gca,'XLabel','\default')

## Examples

The following statement sets the current axes limits to 0 to 10 for the x-axis, -25 to 25 for the y-axis, and -8 to 10 for the z-axis:

    set(gca,'Xlim',[0 10],'Ylim',[-25 25],'Zlim',[-8 10])

Use `set` to list the properties of a particular object that you can specify. For example, the following statement lists the properties that apply to a surface object. Default values are indicated by curly brackets:

    h = surf(peaks);
    set(h)

    CData
    EdgeColor: [ none | {flat} | interp ] -or- a ColorSpec.
    FaceColor: [ none | {flat} | interp | texturemap ] -or- a
         ColorSpec.
    LineStyle: [ {-} | - | : | -. | + | o | * | . | x ]
    MarkerSize
    MeshStyle: [ {both} | row | column ]
    XData
    YData
    ZData
    Children
    Clipping: [ on | off ]
    UserData
    Visible: [ on | off ]

## See Also

    gca, gcf, get

(c) Copyright 1994 by The MathWorks, Inc.