MATLAB Function Reference
  Go to function:
    Search    Help Desk 
Figure Properties

Figure Properties

This section lists property names along with the type of values each accepts. Curly braces { } enclose default values.

BackingStore                 {on} | off

Off screen pixel buffer. When BackingStore is on, MATLAB stores a copy of the Figure window in an off-screen pixel buffer. When obscured parts of the Figure window are exposed, MATLAB copies the window contents from this buffer rather than regenerating the objects on the screen. This increases the speed with which the screen is redrawn.

While refreshing the screen quickly is generally desirable, the buffers required do consume system memory. If memory limitations occur, you can set BackingStore to off to disable this feature and release the memory used by the buffers. If your computer does not support backingstore, setting the BackingStore property results in a warning message, but has no other effect.

Setting BackingStore to off can increase the speed of animations because it eliminates the need to draw into both an off-screen buffer and the Figure window.

BusyAction                   cancel | {queue}

Callback routine interruption. The BusyAction property enables you to control how MATLAB handles events that potentially interrupt executing callback routines. If there is a callback routine executing, subsequently invoked callback routines always attempt to interrupt it. If the Interruptible property of the object whose callback is executing is set to on (the default), then interruption occurs at the next point where the event queue is processed. If the Interruptible property is off, the BusyAction property (of the object owning the executing callback) determines how MATLAB handles the event. The choices are:

ButtonDownFcn                string

Button press callback function. A callback routine that executes whenever you press a mouse button while the pointer is in the Figure window, but not over a child object (i.e., Uicontrol, Axes, or Axes child). Define this routine as a string that is a valid MATLAB expression or the name of an M-file. The expression executes in the MATLAB workspace.

Children                     vector of handles

Children of the Figure. A vector containing the handles of all Axes, Uicontrol, and Uimenu objects displayed within the Figure. You can change the order of the handles and thereby change the stacking of the objects on the display.

Clipping                     {on} | off

This property has no effect on Figures.

CloseRequestFcn              string

Function executed on Figure close. This property defines a function that MATLAB executes whenever you issue the close command (either a close(figure_handle) or a close all) or when you close a Figure window from the computer's window manager menu.

The CloseRequestFcn provides a mechanism to intervene in the closing of a Figure. It allows you to, for example, display a dialog box to ask a user to confirm or cancel the close operation or to prevent users from closing a Figure that contains a GUI.

The basic mechanism is:

This statement unconditionally deletes the current Figure, destroying the window. closereq takes advantage of the fact that the close command makes all Figures specified as arguments the current Figure before calling the respective close request function.

You can set CloseRequestFcn to any string that is a valid MATLAB statement, including the name of an M-file. For example,

This close request function never closes the Figure window; it simply echoes "This window is immortal" on the command line. Unless the close request function calls delete, MATLAB never closes the Figure.

A more useful application of the close request function is to display a question dialog box asking the user to confirm the close operation. The following M-file illustrates how to do this:

Now assign this M-file to the CloseRequestFcn of a Figure:

To make this M-file your default close request function, set a default value on the Root level:

MATLAB then uses this setting for the CloseRequestFcn of all subsequently created Figures.

Color                        ColorSpec

Background color. This property controls the Figure window background color. You can specify a color using a three-element vector of RGB values or one of MATLAB's predefined names. See ColorSpec for more information.

Colormap                     m-by-3 matrix of RGB values

Figure colormap. This property is an m-by-3 array of red, green, and blue (RGB) intensity values that define m individual colors. MATLAB accesses colors by their row number. For example, an index of 1 specifies the first RGB triplet, an index of 2 specifies the second RGB triplet, and so on. Colormaps can be any length (up to 256 only on MS-Windows and Macintosh), but must be three columns wide. The default Figure colormap contains 64 predefined colors.

Colormaps affect the rendering of Surface, Image, and Patch objects, but generally do not affect other graphics objects. See colormap and ColorSpec for more information.

CreateFcn                    string

Callback routine executed during object creation. This property defines a callback routine that executes when MATLAB creates a Figure object. You must define this property as a default value for Figures. For example, the statement,

defines a default value on the Root level that causes the created Figure to use noninteger handles whenever you (or MATLAB) create a Figure. MATLAB executes this routine after setting all properties for the Figure. Setting this property on an existing Figure object has no effect.

The handle of the object whose CreateFcn is being executed is accessible only through the Root CallbackObject property, which you can query using gcbo.

CurrentAxes                  handle of current Axes

Target Axes in this Figure. MATLAB sets this property to the handle of the Figure's current Axes (i.e., the handle returned by the gca command when this Figure is the current Figure). In all Figures for which Axes children exist, there is always a current Axes. The current Axes does not have to be the topmost axes, and setting an Axes to be the CurrentAxes does not restack it above all other Axes.

You can make an Axes current using the axes and set commands. For example, axes(axes_handle) and set(gcf,'CurrentAxes',axes_handle) both make the Axes identified by the handle axes_handle the current Axes. In addition, axes(axes_handle) restacks the Axes above all other Axes in the Figure.

If a Figure contains no Axes, get(gcf,'CurrentAxes') returns the empty matrix. Note that the gca function actually creates an Axes if one does not exist.

CurrentCharacter             single character (read only)

Last key pressed. MATLAB sets this property to the last key pressed in the Figure window. CurrentCharacter is useful for obtaining user input.

CurrentMenu                  (Obsolete)

This property produces a warning message when queried. It has been superseded by the Root CallbackObject property.

CurrentObject                object handle

Handle of current object. MATLAB sets this property to the handle of the object that is under the current point (see the CurrentPoint property). This object is the front-most object in the stacking order. You can use this property to determine which object a user has selected. The function gco provides a convenient way to retrieve the CurrentObject of the CurrentFigure.

CurrentPoint                 two-element vector: [x-coordinate, y-coordinate]

Location of last button click in this Figure. MATLAB sets this property to the location of the pointer at the time of the most recent mouse button press. MATLAB updates this property whenever you press the mouse button while the pointer is in the Figure window.

In addition, MATLAB updates CurrentPoint before executing callback routines defined for the Figure WindowButtonMotionFcn and WindowButtonUpFcn properties. This enables you to query CurrentPoint from these callback routines. It behaves like this:

The Figure CurrentPoint is updated only when certain events occur, as previously described. In some situations, (such as when the WindowButtonMotionFcn takes a long time to execute and the pointer is moved very rapidly) the CurrentPoint may not reflect the actual location of the pointer, but rather the location at the time when the WindowButtonMotionFcn began execution.

The CurrentPoint is measured from the lower-left corner of the Figure window, in units determined by the Units property.

The Root PointerLocation property contains the location of the pointer updated synchronously with pointer movement. However, the location is measured with respect to the screen, not a Figure window.

DeleteFcn                    string

Delete Figure callback routine. A callback routine that executes when the Figure object is deleted (e.g., when you issue a delete or a close command). MATLAB executes the routine before destroying the object's properties so these values are available to the callback routine.

The handle of the object whose DeleteFcn is being executed is accessible only through the Root CallbackObject property, which you can query using gcbo.

Dithermap                    m-by-3 matrix of RGB values

Colormap used for true-color data on pseudocolor displays. This property defines a colormap that MATLAB uses to dither true-color CData for display on pseudocolor (8-bit or less) displays. MATLAB maps each RGB color defined as true-color CData to the closest color in the dithermap. The default Dithermap contains colors that span the full spectrum so any color values map reasonably well.

However, if the true-color data contains a wide range of shades in one color, you may achieve better results by defining your own dithermap. See the DithermapMode property.

DithermapMode                auto | {manual}

MATLAB generated dithermap. In manual mode, MATLAB uses the colormap defined in the Dithermap property to display direct color on pseudocolor displays. When DithermapMode is auto, MATLAB generates a dithermap based on the colors currently displayed. This is useful if the default dithermap does not produce satisfactory results.

The process of generating the dithermap can be quite time consuming and is repeated whenever MATLAB re-renders the display (e.g., when you add a new object or resize the window). You can avoid unnecessary regeneration by setting this property back to manual and save the generated dithermap (which MATLAB loaded into the Dithermap property).

FixedColors                  m-by-3 matrix of RGB values (read only)

Non-colormap colors. Fixed colors define all colors appearing in a Figure window that are not obtained from the Figure colormap. These colors include axis lines and labels, the color of Line, Text, Uicontrol, and Uimenu objects, and any colors that you explicitly define, for example, with a statement like:

Fixed color definitions reside in the system color table and do not appear in the Figure colormap. For this reason, fixed colors can limit the number of simultaneously displayed colors if the number of fixed colors plus the number of entries in the Figure colormap exceed your system's maximum number of colors.

(See the Root ScreenDepth property for information on determining the total number of colors supported on your system. See the MinColorMap and ShareColors properties for information on how MATLAB shares colors between applications.)

HandleVisibility             {on} | callback | off

Control access to object's handle by command-line users and GUIs. This property determines when an object's handle is visible in its parent's list of children. HandleVisibility is useful for preventing command-line users from accidentally drawing into or deleting a Figure that contains only user interface devices (such as a dialog box).

Handles are always visible when HandleVisibility is on.

Setting HandleVisibility to callback causes handles to be visible from within callback routines or functions invoked by callback routines, but not from within functions invoked from the command line. This provides a means to protect GUIs from command-line users, while allowing callback routines to have complete access to object handles.

Setting HandleVisibility to off makes handles invisible at all times. This may be necessary when a callback routine invokes a function that might potentially damage the GUI (such as evaluating a user-typed string), and so temporarily hides its own handles during the execution of that function.

When a handle is not visible in its parent's list of children, it cannot be returned by functions that obtain handles by searching the object hierarchy or querying handle properties. This includes get, findobj, gca, gcf, gco, newplot, cla, clf, and close.

When a handle's visibility is restricted using callback or off, the object's handle does not appear in its parent's Children property, Figures do not appear in the Root's CurrentFigure property, objects do not appear in the Root's CallbackObject property or in the Figure's CurrentObject property, and Axes do not appear in their parent's CurrentAxes property.

You can set the Root ShowHiddenHandles property to on to make all handles visible, regardless of their HandleVisibility settings (this does not affect the values of the HandleVisibility properties).

Handles that are hidden are still valid. If you know an object's handle, you can set and get its properties, and pass it to any function that operates on handles.

HitTest                      {on} | off

Selectable by mouse click. HitTest determines if the Figure can become the current object (as returned by the gco command and the Figure CurrentObject property) as a result of a mouse click on the Figure. If HiTest is off, clicking on the Figure sets the CurrentObject to the empty matrix.

IntegerHandle                {on} | off

Figure handle mode. Figure object handles are integers by default. When creating a new Figure, MATLAB uses the lowest integer that is not used by an existing Figure. If you delete a Figure, its integer handle can be reused.

If you set this property to off, MATLAB assigns nonreusable real-number handles (e.g., 67.0001221) instead of integers. This feature is designed for dialog boxes where removing the handle from integer values reduces the likelihood of inadvertently drawing into the dialog box.

Interruptible                {on} | off

Callback routine interruption mode. The Interruptible property controls whether a Figure callback routine can be interrupted by subsequently invoked callback routines. Only callback routines defined for the ButtonDownFcn, KeyPressFcn, WindowButtonDownFcn, WindowButtonMotionFcn, and WindowButtonUpFcn are affected by the Interruptible property. MATLAB checks for events that can interrupt a callback routine only when it encounters a drawnow, figure, getframe, or pause command in the routine. See the BusyAction property for related information.

InvertHardcopy               {on} | off

Change hardcopy to black objects on white background. This property affects only printed output. Printing a Figure having a background color (Color property) that is not white results in poor contrast between graphics objects and the Figure background and also consumes a lot of printer toner.

When InvertHardCopy is on, MATLAB eliminates this effect by changing the color of the Figure and Axes to white and the axis lines, tick marks, axis labels, etc., to black. Lines, Text, and the edges of Patches and Surfaces may be changed depending on the print command options specified.

If you set InvertHardCopy to off, the printed output matches the colors displayed on the screen.

See print for more information on printing MATLAB Figures.

KeyPressFcn                  string

Key press callback function. A callback routine invoked by a key press occurring in the Figure window. You can define KeyPressFcn as any legal MATLAB expression or the name of an M-file.

The callback routine can query the Figure's CurrentCharacter property to determine what particular key was pressed and thereby limit the callback execution to specific keys.

The callback routine can also query the Root PointerWindow property to determine in which Figure the key was pressed. Note that pressing a key while the pointer is in a particular Figure window does not make that Figure the current Figure (i.e., the one referred by the gcf command).

MenuBar                      none | {figure}

Enable-disable Figure menu bar. This property enables you to display or hide the menu bar placed at the top of a Figure window. The default (figure) is to display the menu bar.

Note that on Macintosh systems, the menu bar for the active window appears across the top of the screen. Menu bars are not displayed across the top of the Figure window as they are on X-Windows and MS-Windows systems, and only one window's menu bar is visible at any given time.

This property affects only built in menus. Menus defined with the uimenu command are not affected by this property.

MinColormap                  scalar (default = 64)

Minimum number of color table entries used. This property specifies the minimum number of system color table entries used by MATLAB to store the colormap defined for the Figure (see the ColorMap property). In certain situations, you may need to increase this value to ensure proper use of colors.

For example, suppose you are running color-intensive applications in addition to MATLAB and have defined a large Figure colormap (e.g., 150 to 200 colors). MATLAB may select colors that are close but not exact from the existing colors in the system color table because there are not enough slots available to define all the colors you specified.

To ensure MATLAB uses exactly the colors you define in the Figure colormap, set MinColorMap equal to the length of the colormap:

Note that the larger the value of MinColorMap, the greater the likelihood other windows (including other MATLAB Figure windows) will display in false colors.

Name                         string

Figure window title. This property specifies the title displayed in the Figure window. By default, Name is empty and the Figure title is displayed as
Figure No. 1, Figure No. 2, and so on. When you set this parameter to a string, the Figure title becomes Figure No. 1: <string>. See the NumberTitle property.

NextPlot                     {add} | replace | replacechildren

How to add next plot. NextPlot determines which Figure MATLAB uses to display graphics output. If the value of the current Figure is:

The newplot function provides an easy way to handle the NextPlot property. Also see the NextPlot property of Axes and the Using MATLAB Graphics manual.

NumberTitle                  {on} | off

Figure window title number. This property determines whether the string Figure No. N (where N is the Figure number) is prefixed to the Figure window title. See the Name property.

PaperOrientation             {portrait} | landscape

Horizontal or vertical paper orientation. This property determines how printed Figures are oriented on the page. portrait orients the longest page dimension vertically; landscape orients the longest page dimension horizontally. See the orient command for more detail.

PaperPosition                four-element rect vector

Location on printed page. A rectangle that determines the location of the Figure on the printed page. Specify this rectangle with a vector of the form

where left specifies the distance from the left side of the paper to the left side of the rectangle and bottom specifies the distance from the bottom of the page to the bottom of the rectangle. Together these distances define the lower-left corner of the rectangle. width and height define the dimensions of the rectangle. The PaperUnits property specifies the units used to define this rectangle.

PaperPositionMode            auto | {manual}

WYSIWYG printing of Figure. In manual mode, MATLAB honors the value specified by the PaperPosition property. In auto mode, MATLAB prints the Figure the same size as it appears on the computer screen, centered on the page.

PaperSize                    [width height] (read only)

Paper size. This property contains the size of the current PaperType, measured in PaperUnits. See PaperType to select standard paper sizes.

PaperType                    Select a value from the following table

Selection of standard paper size. This property sets the PaperSize to the one of the following standard sizes:

Property Value
Size (Width x Height)
usletter (default)
8.5-by-11 inches
uslegal
11-by-14 inches
tabloid
11-by-17 inches
A0
841-by-1189mm
A1
594-by-841mm
A2
420-by-594mm
A3
297-by-420mm
A4
210-by-297mm
A5
148-by-210mm
B0
1029-by-1456mm
B1
728-by-1028mm
B2
514-by-728mm
B3
364-by-514mm
B4
257-by-364mm
B5
182-by-257mm
arch-A
9-by-12 inches
arch-B
12-by-18 inches
arch-C
18-by-24 inches
arch-D
24-by-36 inches
arch-E
36-by-48 inches
A
8.5-by-11 inches
B
11-by-17 inches
C
17-by-22 inches
D
22-by-34 inches
E
34-by-43 inches

Note that you may need to change the PaperPosition property in order to properly position the printed Figure on the new paper size. One solution is to use normalized PaperUnits which enables MATLAB to automatically size the Figure to occupy the same relative amount of the printed page, regardless of the paper size.

PaperUnits                   normalized | {inches} | centimeters |
                             points

Hardcopy measurement units. This property specifies the units used to define the PaperPosition and PaperSize properties. All units are measured from the lower-left corner of the page. normalized units map the lower-left corner of the page to (0, 0) and the upper-right corner to (1.0, 1.0). inches, centimeters, and points are absolute units (one point equals 1/72 of an inch).

If you change the value of PaperUnits, it is good practice to return it to its default value after completing your computation so as not to affect other functions that assume PaperUnits is set to the default value.

Parent                       handle

Handle of Figure's parent. The parent of a Figure object is the Root object. The handle to the Root is always 0.

Pointer                      crosshair | {arrow} | watch | topl |
                             topr | botl | botr | circle | cross |
                             fleur | left | right | top | bottom |
                             fullcrosshair | ibeam | custom

Pointer symbol selection. This property determines the symbol used to indicate the pointer (cursor) position in the Figure window. Setting Pointer to custom allows you to define your own pointer symbol. See the PointerShapeCData property for more information. See also the Using MATLAB Graphics manual.

PointerShapeCData            16-by-16 matrix

User-defined pointer. This property defines the pointer that is used when you set the Pointer property to custom. It is a 16-by-16 element matrix defining the 16-by-16 pixel pointer using the following values:

Element (1,1) of the PointerShapeCData matrix corresponds to the upper-left corner of the pointer. Setting the Pointer property to one of the predefined pointer symbols does not change the value of the PointerShapeCData. Computer systems supporting 32-by-32 pixel pointers fill only one quarter of the available pixmap.

PointerShapeHotSpot          2-element vector

Pointer active area. A two-element vector specifying the row and column indices in the PointerShapeCData matrix defining the pixel indicating the pointer location. The location is contained in the CurrentPoint property and the Root object's PointerLocation property. The default value is element (1,1), which is the upper-left corner.

Position                     four-element vector

Figure position. This property specifies the size and location on the screen of the Figure window. Specify the position rectangle with a four-element vector of the form:

where left and bottom define the distance from the lower-left corner of the screen to the lower-left corner of the Figure window. width and height define the dimensions of the window. See the Units property for information on the units used in this specification. The left and bottom elements can be negative on systems that have more than one monitor.

You can use the get function to obtain this property and determine the position of the Figure and you can use the set function to resize and move the Figure to a new location.

Renderer                     painters | zbuffer

Rendering method used for screen and printing. This property enables you to select the method used to render MATLAB graphics. The choices are:

Using the OpenGL Renderer

The Figure Renderer property supports a new value that enables MATLAB to use OpenGL as the renderer. The command to enable OpenGL on the current Figure is:

OpenGL increases performance for most 2-D and 3-D graphs drawn with MATLAB.

Hardware Vs. Software OpenGL Implementations

There are two kinds of OpenGL implementations - hardware and software.

The hardware implementation makes use of special graphics hardware to increase performance and is therefore significantly faster than the software version. Many computers have this special hardware available as an option or may come with this hardware right out of the box.

Software implementations of OpenGL are much like the ZBuffer renderer that is available on MATLAB version 5.0, however, OpenGL generally provides superior performance to ZBuffer.

OpenGL Availability

OpenGL is available on all computers that MATLAB runs on with the exception of VMS. MATLAB automatically finds hardware versions of OpenGl if they are available. If the hardware version is not available, then MATLAB uses the software version.

The software versions that are available on different platforms are:

Tested Hardware Versions

On MS-Windows platforms, there are many graphics boards that accelerate OpenGL. The MathWorks has tested MATLAB on the AccelECLIPSE board from AccelGraphics.

On UNIX platforms, The MathWorks has tested MATLAB on Sparc Ultra with the Creator 3D board and Silicon Graphics computers running IRIX 6.4 or newer.

Determining What Version You Are Using

To determine the version and vendor of the OpenGL library that MATLAB is using on your system, type the following command at the MATLAB prompt:

This command also returns a string of extensions to the OpenGL specification that are available with the particular library MATLAB is using. This information is helpful to The MathWorks so please include this information if you need to report bugs.

OpenGL Vs. Other MATLAB Renderers

There are some difference between drawings created with OpenGL and those created with the other renderers. The OpenGL specific differences include:

MATLAB issues a warning if you request nonsupported behavior.

Printing from OpenGL

When you print a Figure that was drawn with OpenGL, MATLAB switches to the ZBuffer renderer to produce output, which has a resolution determined by the print command's -r option. This may cause flashing of the Figure as the renderer changes.

Implementations of OpenGL Tested by TMW

The following hardware versions have been tested:

The following software versions have been tested:

RendererMode                 {auto} | manual

Automatic, or user selection of Renderer. This property enables you to specify whether MATLAB should choose the Renderer based on the contents of the figure window, or whether the Renderer should remain unchanged.

When the RendererMode property is set to auto, MATLAB selects the rendering method for printing as well as for screen display based on the size and complexity of the graphics objects in the Figure.

For printing, MATLAB switches to zbuffer at a greater scene complexity than for screen rendering because printing from a Z-buffered Figure can be considerably slower than one using the painters rendering method, and can result in large PostScript files. However, the output does always match what is on the screen. The same holds true for OpenGL, the output is the same as that produced by the ZBuffer renderer - a bitmap with a resolution determined by the print command's -r option

When the RendererMode property is set to manual, MATLAB does not change the Renderer, regardless of changes to the Figure contents.

Resize                       {on} | off

Window resize mode. This property determines if you can resize the Figure window with the mouse. on means you can resize the window, off means you cannot. When Resize is off, the Figure window does not display any resizing controls (such as boxes at the corners) to indicate that it cannot be resized.

ResizeFcn                    string

Window resize callback routine. MATLAB executes the specified callback routine whenever you resize the Figure window. You can query the Figure's Position property to determine the new size and position of the Figure window. During execution of the callback routine, the handle to the Figure being resized is accessible only through the Root CallbackObject property, which you can query using gcbo.

You can use ResizeFcn to maintain a GUI layout that is not directly supported by MATLAB's Position/Units paradigm.

For example, consider a GUI layout that maintains an object at a constant height in pixels and attached to the top of the Figure, but always matches the width of the Figure. The following ResizeFcn accomplishes this; it keeps the Uicontrol whose Tag is 'StatusBar' 20 pixels high, as wide as the Figure, and attached to the top of the Figure. Note the use of the Tag property to retrieve the Uicontrol handle, and the gcbo function to retrieve the Figure handle. Also note the defensive programming regarding Figure Units, which the callback requires to be in pixels in order to work correctly, but which the callback also restores to their previous value afterwards:

You can change the Figure Position from within the ResizeFcn callback; however the ResizeFcn is not called again as a result.

Note that the print command can cause the ResizeFcn to be called if the PaperPositionMode property is set to manual and you have defined a resize function. If you do not want your resize function called by print, set the PaperPositionMode to auto.

Selected                     on | off

Is object selected. This property indicates whether the Figure is selected. You can, for example, define the ButtonDownFcn to set this property, allowing users to select the object with the mouse.

SelectionHighlight           {on} | off

Figures do not indicate selection.

SelectionType                {normal} | extend | alt | open
                             (this property is read only)

Mouse selection type. MATLAB maintains this property to provide information about the last mouse button press that occurred within the Figure window. This information indicates the type of selection made. Selection types are actions that are generally associated with particular responses from the user interface software (e.g., single clicking on a graphics object places it in move or resize mode; double-clicking on a filename opens it, etc.).

The physical action required to make these selections varies on different platforms. However, all selection types exist on all platforms.

Selection Type
MS-Windows
X-Windows
Macintosh
Normal
Click left mouse button
Click left mouse button
Click mouse button
Extend
Shift - click left mouse button or
click both left and right mouse buttons
Shift - click left mouse button
or click
middle mouse button
Shift - click mouse button
Alternate
Control - click left mouse button or click right mouse button
Control - click left mouse button
or click
right mouse button
Option - click mouse button
Open
Double click any mouse button
Double click any mouse button
Double click mouse button

Note that the ListBox style of Uicontrols set the Figure SelectionType property to normal to indicate a single mouse click or to open to indicate a double mouse click.

ShareColors                  {on} | off

Share slots in system colortable with like colors. This property affects the way MATLAB stores the Figure colormap in the system color table. By default, MATLAB looks at colors already defined and uses those slots to assign pixel colors. This leads to an efficient use of color resources (which are limited on systems capable of displaying 256 or less colors) and extends the number of Figure windows that can simultaneously display correct colors.

However, in situations where you want to change the Figure colormap quickly without causing MATLAB to re-render the displayed graphics objects, you should disable color sharing (set ShareColors to off). In this case, MATLAB can swap one colormap for another without changing pixel color assignments since all the slots in the system color table used for the first colormap are replaced with the corresponding color in the second colormap. (Note that this applies only in cases where both colormaps are the same length and where the computer hardware allows user modification of the system color table.)

Tag                          string

User-specified object label. The Tag property provides a means to identify graphics objects with a user-specified label. This is particularly useful when constructing interactive graphics programs that would otherwise need to define object handles as global variables or pass them as arguments between callback routines.

For example, suppose you want to direct all graphics output from an M-file to a particular Figure, regardless of user actions that may have changed the current Figure. To do this, identify the Figure with a Tag:

Then make that Figure the current Figure before drawing by searching for the Tag with findobj:

Type                         string (read only)

Object class. This property identifies the kind of graphics object. For Figure objects, Type is always the string 'figure'.

UIContextMenu                handle of a uicontextmenu object

Associate a context menu with the Figure. Assign this property the handle of a Uicontextmenu object created in the Figure. Use the uicontextmenu function to create the context menu. MATLAB displays the context menu whenever you right-click over the Figure (Control-click on Macintosh systems).

Units                        {pixels} | normalized | inches |
                              centimeters | points | character

Units of measurement. This property specifies the units MATLAB uses to interpret size and location data. All units are measured from the lower-left corner of the window.

This property affects the CurrentPoint and Position properties. If you change the value of Units, it is good practice to return it to its default value after completing your computation so as not to affect other functions that assume Units is set to the default value.

When specifying the units as property/value pairs during object creation, you must set the Units property before specifying the properties that you want to use these units.

UserData                     matrix

User specified data. You can specify UserData as any matrix you want to associate with the Figure object. The object does not use this data, but you can access it using the set and get commands.

Visible                      {on} | off

Object visibility. The Visible property determines whether an object is displayed on the screen. If the Visible property of a Figure is off, the entire Figure window is invisible.

WindowButtonDownFcn          string

Button press callback function. Use this property to define a callback routine that MATLAB executes whenever you press a mouse button while the pointer is in the Figure window. Define this routine as a string that is a valid MATLAB expression or the name of an M-file. The expression executes in the MATLAB workspace.

WindowButtonMotionFcn        string

Mouse motion callback function. Use this property to define a callback routine that MATLAB executes whenever you move the pointer within the Figure window. Define this routine as a string that is a valid MATLAB expression or the name of an M-file. The expression executes in the MATLAB workspace.

WindowButtonUpFcn            string

Button release callback function. Use this property to define a callback routine that MATLAB executes whenever you release a mouse button. Define this routine as a string that is a valid MATLAB expression or the name of an M-file. The expression executes in the MATLAB workspace.

The button up event is associated with the Figure window in which the preceding button down event occurred. Therefore, the pointer need not be in the Figure window when you release the button to generate the button up event.

If the callback routines defined by WindowButtonDownFcn or WindowButtonMotionFcn contain drawnow commands or call other functions that contain drawnow commands and the Interruptible property is set to off, the WindowButtonUpFcn may not be called. You can prevent this problem by setting Interruptible to on.

WindowStyle                  {normal} | modal

Normal or modal window behavior. When WindowStyle is set to modal, the Figure window traps all keyboard and mouse events over all MATLAB windows as long as they are visible. Windows belonging to applications other than MATLAB are unaffected. Modal Figures remain stacked above all normal Figures and the MATLAB command window. When multiple modal windows exist, the most recently created window keeps focus and stays above all other windows until it becomes invisible, or is returned to WindowStyle normal, or is deleted. At that time, focus reverts to the window that last had focus.

Figures with WindowStyle modal and Visible off do not behave modally until they are made visible, so it is acceptable to hide a modal window instead of destroying it when you want to reuse it.

You can change the WindowStyle of a Figure at any time, including when the Figure is visible and contains children. However, on some systems this may cause the Figure to flash or disappear and reappear, depending on the windowing-system's implementation of normal and modal windows. For best visual results, you should set WindowStyle at creation time or when the Figure is invisible.

Modal Figures do not display Uimenu children or built-in menus, but it is not an error to create Uimenus in a modal Figure or to change WindowStyle to modal on a Figure with Uimenu children. The Uimenu objects exist and their handles are retained by the Figure. If you reset the Figure's WindowStyle to normal, the Uimenus are displayed.

Use modal Figures to create dialog boxes that force the user to respond without being able to interact with other windows. Typing Control C at the MATLAB prompt causes all Figures with WindowStyle modal to revert to WindowStyle normal, allowing you to type at the command line.



[ Previous | Help Desk | Next ]