Graphics Previous page   Next Page

Core Graphics Objects

Core graphics objects include basic drawing primitives like line, text, and polygon shells (patch objects); specialized objects like surfaces, which are composed of a rectangular grid of vertices; images; and light objects, which are not visible but affect the way some objects are colored.

Axes contain objects that represent data, such as line, surfaces, contourgroups, etc.

The following table lists the core graphics objects and links to the reference pages of the functions used to create each object.

.

Core Graphics Objects
Function
Purpose
axes
Axes objects define the coordinate system for displaying graphs. Axes are always contained within a figure.
image
2-D representation of a matrix where numeric values are mapped to colors. Images can also be 3-D arrays of RGB values.
light
Directional light source located within the axes. Lights affect patches and surfaces, but cannot themselves be seen.
line
A line is drawn by connecting the data points that define it.
patch
Filled polygons with separate edge properties. A single patch can contain multiple faces, each colored independently with solid or interpolated colors.
rectangle
2-D object that has settable edge and face color, and variable curvature (can draw ellipses)
surface
3-D grid of quadrilaterals created by plotting the value of each element in a matrix as a height above the x-y plane
text
Character strings positioned in the coordinate system defined by the axes

The following picture illustrates some typical core graphics objects.

Description of Core Graphics Objects

This section describes the core graphics objects.

Axes

Axes objects define a frame of reference in a figure window for the display objects that are generally defined by data. For example, MATLAB creates a line by connecting each data point with a line segment. The axes determines the location of each data point in the figure by defining axis scales (x, y, and z or radius and angle, etc.)

Axes are children of figures and are parents of core, plot, and group objects.

Note that, while annotation objects are also children of axes, they can be parented only to the hidden annotation axes (see the annotation function for more information).

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 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 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 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.


Previous page  Graphics Windows -- the Figure Example -- Creating Core Graphics Objects Next page

© 1994-2005 The MathWorks, Inc.