Documentation Center

  • Trial Software
  • Product Updates

Object Properties


A graphics object's properties control many aspects of its appearance and behavior. Properties include general information such as the object's type, its parent and children, and whether it is visible, as well as information unique to the particular class of object.

For example, from any given figure object you can obtain the identity of the last key pressed in the window, the location of the pointer, or the handle of the most recently selected menu.

Storing Object Information

MATLAB® organizes graphics information into a hierarchy and stores information about objects in properties. For example, root properties contain the handle of the current figure and the current location of the pointer (cursor), figure properties maintain lists of their descendants and keep track of certain events that occur within the window, and axes properties contain information about how each child object uses the figure colormap and the color order used by the plot function.

Changing Values

You can query the current value of any property and specify most property values (although some are set by MATLAB and are read only). Property values apply uniquely to a particular instance of an object; setting a value for one object does not change this value for other objects of the same type.

Order Dependence of Setting Property Values

MATLAB sets the values of properties in the order in which properties are assigned values in a statement. For example, the following calls to the figure function create very different results. This statement,

figure('Position',[1 1 400 300],'Units','inches')

creates a figure in the lower-left corner of the screen that is 400 pixels in width and 300 pixels in height. If you reverse the order of the Position and Units properties, MATLAB creates a figure that is too large to display (400 by 300 inches):

figure('Units','inches','Position',[1 1 400 300])

Properties Are Interpreted from Left to Right

In the first figure above, MATLAB creates a figure of the specified size using the default Units (pixels) and then sets the Units to inches. In the second case MATLAB sets the Units to inches and uses these units to interpret the specified figure Position. MATLAB interprets the property values from left to right:

ans =
  1.0e+004 *
    0.0097    2.7760    0.1924    0.1137
% Change the Units, set the Position,
% and change Units again in one statement
set(gcf,'Units','pixels','Position',[1 1 400 300],'Units',...
ans =
         0         0    4.1667    3.1250

Default Values

You can set default values that affect all subsequently created objects. Whenever you do not define a value for a property, either as a default or when you create the object, MATLAB uses "factory-defined" values.

Plot objects do not allow you to set default values.

The reference entry for each object creation function provides a complete list of the properties associated with the graphics object.

Properties Common to All Objects

Some properties are common to all graphics objects, as illustrated in the following table.




Has a value of on when object's DeleteFcn has been called.


Controls the way MATLAB handles callback routine interruption defined for the particular object.


Callback routine that executes when button press occurs.


Handles of all this object's child objects.


Mode that enables or disables clipping (meaningful only for axes children).


Callback routine that executes when this type of object is created.


Callback routine that executes when you issue a command that destroys the object.


Allows you to control the availability of the object's handle from the command line and from within callback routines.


Determines if object can become the current object when selected by a mouse click.


Determines whether a callback routine can be interrupted by a subsequently invoked callback routine.


The object's parent.


Indicates whether object is selected.


Specifies whether object visually indicates the selection state.


User-specified object label.


The type of object (figure, line, text, etc.).


Any data you want to associate with the object.


Determines whether or not the object is visible.

Was this topic helpful?