FUNCTION REFERENCE
text
Place a text label at data coordinates in the current axes.
Place a text label at data coordinates in the current axes.
Syntax
t = text(x, y, str)Syntax
t = text(x, y, z, str)Syntax
t = text(ax, x, y, str, Name, Value)x and y give the anchor point in data units; vectors place one label per point. str is character text or a cell array with one string per point. Properties: String, Position, Color, FontSize (points, default 10), FontWeight, HorizontalAlignment (left, center, right), VerticalAlignment (middle, top, bottom, baseline, cap), Rotation (degrees), Visible. Change them later with set or dot syntax, for example t.Color = 'r'. Unlike plot, text never replaces what the axes already show.
Example
plot(1:5); t = text(2, 3, 'peak', 'Color', 'r', 'FontSize', 12); t.Rotation = 30;Example
t = text([1 2], [1 4], {'a', 'b'}); numel(t) % 2Interpreter defaults to tex; none draws source text literally and latex renders a $...$ / $$...$$ math subset (fractions, sub/superscripts, Greek, \sqrt, \mathrm/\mathbf, \left/\right, \sum/\int and common symbols; unsupported syntax falls back to plain text). Only data Units. Text objects and colorbars are not stored in .fig or session files yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.