Contenido principal

Annotation

R2026b

Descriptive text or image in chart

Description

An annotation is a text or image box that you add to a chart that provides descriptive comments. Annotations do not affect chart execution. Annotations can contain any combination of text, images, TeX equations, or hyperlinks.

To add an annotation to a chart:

  1. In the object palette, click the Annotation icon The Annotation object palette icon..

  2. Click the location in the chart canvas where you want to place the annotation.

  3. Enter the annotation text and click outside the annotation box.

Properties

expand all

To edit graphical object properties interactively, right-click the object and select Properties.

To modify the properties of the annotation object programmatically, use Stateflow.Annotation objects.

General

Appearance options for the annotation box, specified as a set of check boxes.

  • Fixed height — Select this property to fix the height of the annotation box and hide content that exceeds the box height. When cleared, the annotation box resizes vertically as you add content.

  • Fixed width — Select this property to fix the width of the annotation box and wrap text that exceeds the box width. When cleared, the annotation box resizes horizontally as you add content.

  • Shadow — Select this property to display a drop shadow around the annotation box.

  • Enable TeX commands — Select this property to render the annotation text by using TeX commands.

Text color for the annotation, specified as a color selected from the dropdown menu. Select Automatic to use the default foreground color of the chart.

Background color for the annotation box, specified as a color selected from the dropdown menu. Select Automatic to use the default background color of the chart.

Horizontal alignment of the annotation text, specified as one of these values.

  • Left — Aligns text to the left edge of the annotation box.

  • Center — Centers text in the annotation box.

  • Right — Aligns text to the right edge of the annotation box.

Font for the annotation text. Click Font to open the Select Font dialog box. Set the font name, style, and size for the annotation text.

Space between the annotation text and the left border of the annotation box, specified as a scalar. The default value is 0.

Space between the annotation text and the top border of the annotation box, specified as a scalar. The default value is 0.

Space between the annotation text and the right border of the annotation box, specified as a scalar. The default value is 0.

Space between the annotation text and the bottom border of the annotation box, specified as a scalar. The default value is 0.

ClickFcn

These properties appear only for text annotations.

Text of the annotation, specified as a string. The default value is blank.

MATLAB® code to execute when you click the annotation, specified as a string. For example, to navigate to a website specified in the annotation text, use an = getCallbackAnnotation; web(an.Text);.

Whether to use the annotation display text as the click callback. When you select this property, the contents of the Text field execute as MATLAB code when you click the annotation.

Documentation

Description of the annotation, specified as a text string.

Link to documentation for the annotation, specified as a web URL or a MATLAB command that displays documentation as an HTML file or as text in the MATLAB Command Window. When you click the Document link hyperlink, Stateflow® evaluates the link and displays the documentation.

Version History

Introduced in R2017b