Add Annotations to Graph Interactively

These examples show how to interactively add annotations to a graph and pin them to the axes.

Add Annotations

Create a simple line plot.

x = linspace(1,10);
Interactively add a text arrow and an ellipse to the graph using the figure Insert menu. Position the text arrow by drawing an arrow from tail to head and typing the text at the text cursor next to the tail. Click outside the text entry box to apply the text. Position the ellipse using the mouse to draw.

To change the location of an annotation, drag it. To modify the appearance of an annotation, right-click it and use the context menu. To view additional properties, open the Property Editor select Show Property Editor from the context menu.

Pin Annotations to Points in Graph

Pin the text arrow and ellipse to the axes so that they stay associated with the same coordinates in the axes, even when you pan the axes or resize the figure. Right-click it and select Pin to Axes. Pin both ends of the text arrow.

Click the pan icon in the figure toolbar and pan the axes by dragging it. The text arrow and ellipse stay associated with the same points in the axes. To unpin an object, right-click it and select Unpin.

See Also

Related Examples

Was this topic helpful?