MATLAB Function Reference Previous page   Next Page
annotation

Create annotation objects

Syntax

Description

annotation(annotation_type) creates the specified annotation type using default values for all properties. annotation_type can be one of the following strings:

line, arrow, doublearrow (two-headed arrow), textarrow (arrow with attached text box), textbox, ellipse, or rectangle.

annotation('line',x,y) creates a line annotation object that extends from the point defined by x(1),y(1) to the point defined by x(2),y(2), specified in normalized figure units.

annotation('arrow',x,y) creates an arrow annotation object that extends from the point defined by x(1),y(1) to the point defined by x(2),y(2), specified in normalized figure units.

annotation('doublearrow',x,y) creates a two-headed annotation object that extends from the point defined by x(1),y(1) to the point defined by x(2),y(2), specified in normalized figure units.

annotation('textarrow',x,y) creates a textarrow annotation object that extends from the point defined by x(1),y(1) to the point defined by x(2),y(2), specified in normalized figure units. The tail end of the arrow is attached to an editable textbox.

annotation('textbox',[x y w h]) creates an editable textbox annotation with its lower-left corner at the point x,y, a width w, and a height h, specified in normalized figure units. Specify x, y, w, and h in a single vector.

To type into the textbox, enable plot edit mode (plotedit) and double click within the box.

annotation('ellipse',[x y w h]) creates an ellipse annotation with the lower-left corner of the bounding rectangle at the point x,y, a width w, and a height h, specified in normalized figure units. Specify x, y, w, and h in a single vector.

annotation('rectangle',[x y w h]) creates a rectangle annotation with the lower-left corner of the rectangle at the point x,y, a width w, and a height h, specified in normalized figure units. Specify x, y, w, and h in a single vector.

annotation(figure_handle,...) creates the annotation in the specified figure.

annotation(...,'PropertyName',PropertyValue,...) creates the annotation and sets the specified properties to the specified values.

anno_obj_handle = annotation(...) returns the handle to the annotation object that is created.

Annotation Layer

All annotation objects are displayed in an overlay axes that covers the figure. This layer is designed to display only annotation objects. You should not parent objects to this axes or set any properties of this axes. See the See Also section for information on the properties of annotation objects that you can set.

Objects in the Plotting Axes

You can create lines, text, rectangles, and ellipses in data coordinates in the axes of a graph using the line, text, and rectangle functions. These objects are not placed in the annotation axes and must be located inside their parent axes.

Normalized Coordinates

Annotation objects use normalize coordinates to specify locations within the figure. In normalized coordinates, the point 0,0 is always the lower-left corner and the point 1,1 is always the upper-right corner of the figure window regardless of the figure size.

See Also

Properties for the annotation objects: arrow, doublearrow, ellipse, line, rectangle, textarrow, textbox

See Annotating Graphs and Annotation Objects for more information.


Previous page  angle Annotation Arrow Properties Next page

© 1994-2005 The MathWorks, Inc.