Graphics    

Types of Graphics Objects

Graphics objects are interdependent so the graphics display typically contains a variety of objects that, in conjunction, produce a meaningful graph or picture. The following picture of a figure window contains a number of graphics objects.

Each type of graphics object has a corresponding creation function that you use to create an instance of that class of object. Object creation functions have the same names as the objects they create (e.g., the text function creates text objects, the figure function creates figure objects, and so on).

Handle Graphics Objects

The following list summarizes the Handle Graphics objects.

The Root

At the top of the hierarchy is the root object. It corresponds to the computer screen. There is only one root object and all other objects are its descendants. You do not create the root object; it exists when you start MATLAB. You can, however, set the values of root properties and thereby affect the graphics display.

Figure

Figure objects are the individual windows on the root screen where MATLAB displays graphics. MATLAB places no limits on the number of figure windows you can create (your computer may, however). All figures are children of the root and all other graphics objects are descendants of figures.

All functions that draw graphics (e.g., plot and surf) automatically create a figure if one does not exist. If there are multiple figures within the root, one figure is always designated as the "current" figure, and is the target for graphics output.

Uicontrol

Uicontrol objects are user interface controls that execute callback routines when users activate the object. There are a number of styles of controls such as pushbuttons, listboxes, and sliders. Each device is designed to accept a certain type of information from users. For example, listboxes are typically used to provide a list of filenames from which you select one or more items for action carried out by the control's callback routine.

You can use uicontrols in combinations to construct control panels and dialog boxes. Pop-up menus, editable text boxes, check boxes, pushbuttons, static text, and frames compose this particular example.

.

Uicontrol objects are children of figures and are therefore independent of axes.

Uimenu

Uimenu objects are pull-down menus that execute callback routines when users select an individual menu item. MATLAB places uimenus on the figure window menu bar, to the right of existing menus defined by the system. This picture shows the top of an MS-Windows figure that has three top-level uimenus defined (titled Workspace, Figure, and Axes). Two levels of submenus are visible under Workspace top-level uimenu.

Uimenus are children of figures and are therefore independent of axes.

Axes

Axes objects define a region in a figure window and orient their children within this region. axes are children of figures and are parents of image, light, line, patch, surface, and text objects.

All functions that draw graphics (e.g., plot, surf, mesh, and bar) create an axes object if one does not exist. If there are multiple axes within the figure, one axes is always designated as the "current" axes, and is the target for display of the above mentioned graphics objects (uicontrols and uimenus are not children of axes).

Image

A MATLAB image consists of a data matrix and possibly a colormap. There are three basic image types that differ in the way that data matrix elements are interpreted as pixel colors -- indexed, intensity, and truecolor. Since images are strictly 2-D, you can view them only at the default 2-D view.

Light

Light objects define light sources that affect all patch and surface objects within the axes. You cannot see lights, but you can set properties that control the style of light source, color, location, and other properties common to all graphics objects.

Line

Line objects are the basic graphics primitives used to create most 2-D and some 3-D plots. High-level functions plot, plot3, and loglog (and others) create line objects. The coordinate system of the parent axes positions and orients the line.

Patch

Patch objects are filled polygons with edges. A single patch can contain multiple faces, each colored independently with solid or interpolated colors. fill, fill3, and contour3 create patch objects. The coordinate system of the parent axes positions and orients the patch.

Rectangle

Rectangle objects are 2-D filled areas having a shape that can range from a rectangle to an ellipse. Rectangles are useful for creating flow-chart type drawings.

Surface

Surface objects are 3-D representations of matrix data created by plotting the value of each matrix element as a height above the x-y plane. Surface plots are composed of quadrilaterals whose vertices are specified by the matrix data. MATLAB can draw surfaces with solid or interpolated colors or with only a mesh of lines connecting the points. The coordinate system of the parent axes positions and orients the surface.

The high-level function pcolor and the surf and mesh group of functions create surface objects.

Text

Text objects are character strings. The coordinate system of the parent axes positions the text. The high-level functions title, xlabel, ylabel, zlabel, and gtext create text objects.


  Graphics Object Hierarchy Object Properties