FUNCTION REFERENCE
annotation
Add a line, arrow, rectangle, ellipse or text box annotation to a figure.
Add a line, arrow, rectangle, ellipse or text box annotation to a figure.
Syntax
h = annotation(type, x, y, Name, Value)Syntax
h = annotation(type, dim, Name, Value)Syntax
h = annotation(fig, ...)Creates a figure-level annotation in normalized figure coordinates. Line types ('line', 'arrow', 'doublearrow', 'textarrow') take 2-element X and Y vectors; shape types ('rectangle', 'ellipse') and 'textbox' take a 4-element [x y w h] position vector. Supports Color, LineWidth, LineStyle, HeadStyle ('vback2', 'plain', 'none'), HeadLength, HeadWidth, String, FontSize, FaceColor and FaceAlpha.
Example
f = figure; t = annotation(f, 'textbox', [0 0.9 1 0.1], 'String', 'Note', 'Interpreter', 'none', 'EdgeColor', 'none'); % text box at the top of the figureExample
a = annotation('arrow', [0.2 0.5], [0.2 0.5], 'Color', 'r'); % red arrowExample
r = annotation('rectangle', [0.1 0.1 0.3 0.2], 'FaceColor', 'b', 'FaceAlpha', 0.3); % translucent blue rectangleDifferences from MATLAB: Not checked against MATLAB yet. Normalized figure units only; HeadStyle supports 'vback2', 'plain' and 'none'; 'textbox' requires explicit Interpreter 'none' and EdgeColor 'none'.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.