Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

MATLAB Plot Label: xlabel, ylabel, title and Point Labels

Label a MATLAB plot with xlabel, ylabel, title, legend and text, including TeX/LaTeX, per-point labels and tiled layouts, per MathWorks documentation.

Written and maintained by CASRAI Editorial Board

Last updated

Short answer: in MATLAB you label a plot with xlabel and ylabel for the axes, title for the heading, legend for series names and text for labels placed at individual data points. Each takes the text first and optional Name=Value pairs after it, for example xlabel("My Label",Color="red",FontSize=12). This guide is for researchers and analysts who have a plot on screen and need it to carry units, a title and readable annotations before it goes into a paper, poster or report.

What plot labels are used for in research

An unlabelled figure cannot be interpreted on its own: readers need the quantity and unit on each axis, a title or caption that states what is shown, and a legend or point labels that identify each series or observation. MATLAB provides one function per job, and all of them are documented in the MATLAB reference pages listed under Sources. For the wider workflow of building and exporting a figure, see plotting a graph in MATLAB and graphing in MATLAB.

Install or access (official source only)

MATLAB is a MathWorks product, and the label functions on this page ship with base MATLAB; no extra toolbox is named on their reference pages. Obtain MATLAB from MathWorks or through your institution’s licence, and use the MathWorks documentation for your installed release. If you want a general orientation first, read what MATLAB is used for.

Step-by-step: label a plot

  1. Create the plot. For example x = 1:5; y = x.^2; plot(x,y,'o-').
  2. Label the axes. xlabel('Time (s)') and ylabel('Displacement (m)'). Both accept the same syntax: xlabel(txt), xlabel(target,txt), xlabel(___,Name=Value) and t = xlabel(___). The optional target is the axes (or tiled layout, or a standalone chart that has an XLabel property) to label.
  3. Add a title, and optionally a subtitle. title('Displacement over time'), or title('Displacement over time','Trial 3') to add a subtitle underneath. The forms title(target,___) and [t,s] = title(___) let you choose the axes and keep handles to the title and subtitle.
  4. Name the series. Either list the names in order, legend('Jan','Feb','Mar'), or set 'DisplayName' on each series and call legend with no arguments. To list only some series, pass their handles first: legend([p1 p3],{'First','Third'}).
  5. Label individual points. text(x,y,txt) places text at the coordinates given. If x and y are vectors and txt is a cell array with one string per point, each point gets its own label: text(x,y,{'A','B','C','D','E'}). A single string is repeated at every point. In 3-D axes use text(x,y,z,txt); see 3-D plots in MATLAB.
  6. Adjust appearance. Use Name=Value pairs: FontSize (default 11 points), FontWeight ('normal' or 'bold'), FontName, Color (default [0.15 0.15 0.15]; accepts an RGB triplet, a hex colour or a colour name) and Rotation in degrees (positive is counterclockwise). To colour the data itself rather than the text, see plot colours and line styles.

TeX and LaTeX in labels

The Interpreter property controls how label text is read. Its default is "tex"; the alternatives are "latex" and "none".

  • TeX (default): ^{ } gives a superscript and _{ } a subscript; bf, it, sl and rm change the font style; fontname{..}, fontsize{..} and color{..} change the font inside the string; Greek and symbols such as alpha, leq and pi are supported. Example: ylabel('Rate alpha_{0} (s^{-1})').
  • LaTeX: wrap inline maths in single dollar signs and display maths in double dollar signs, and set the interpreter: xlabel('$x^{2}$','Interpreter','latex'). The LaTeX text is limited to 1200 characters (each additional line reduces that allowance by about 10). With the LaTeX interpreter, FontName, FontWeight and FontAngle have no effect.
  • None: use "none" when the text contains characters such as _ or ^ that you want printed literally.

Labelling tiled layouts

The target argument is how you label one plot among several. With tiledlayout(2,1); ax1 = nexttile; plot((1:10).^2); xlabel(ax1,'Population') the label goes on the first tile’s axes only. A TiledChartLayout can itself be the target of xlabel, ylabel and title, which gives the whole layout a shared label or title. For the older subplot approach see subplots in MATLAB.

Output and how to read it

Call What appears Handle returned
xlabel, ylabel Text beside the x- or y-axis t = xlabel(___)
title Text above the axes; a second argument adds a subtitle underneath. Default font size is 11 for the title text; the axes title otherwise follows the axes font size (10) times TitleFontSizeMultiplier (1.1) t = title(___) or [t,s] = title(___)
legend Key mapping each series to a name; entries come from DisplayName, and an empty DisplayName gives an entry of the form dataN Legend object
text Text at data coordinates, one string per point when given a cell array t = text(___)

Keep the returned handle if you will change the label later: setting properties on it, for example t.FontSize = 14, edits the existing label instead of creating a new one. The legend updates automatically when series are added or deleted unless its AutoUpdate property is set to 'off'. To leave one item (such as a reference line) out of the legend, pass an empty label in its place, as in legend('sin(x)','sin(x+1)','').

Troubleshooting

  • The font or colour change has no effect. MathWorks states that modifying the label appearance is not supported for all types of charts, and standalone visualizations do not support appearance changes. Check whether your chart type supports it, or label the axes of a standard plot instead.
  • The font name or weight is ignored. With Interpreter set to "latex", FontName, FontWeight and FontAngle have no effect; set the style inside the LaTeX string or return to "tex".
  • A long LaTeX label. Keep LaTeX label text within 1200 characters, and remember multi-line text reduces the allowance.
  • Underscores become subscripts. The default interpreter is TeX. Set Interpreter to "none" for literal text.
  • The label lands on the wrong plot. When a figure has more than one axes, pass the axes (or tiled layout) as the first argument.
  • Legend shows data1, data2. The series have no DisplayName; set it when plotting or pass the names to legend.

Free alternatives

Tool Axis label Title Text at a point
GNU Octave xlabel (string), ylabel (string), also xlabel (hax, ...) title (string) text (x, y, string)
Python Matplotlib Axes.set_xlabel(xlabel, fontdict=None, labelpad=None, *, loc=None, **kwargs), with loc one of ‘left’, ‘center’, ‘right’ Axes.set_title Not covered on this page; see the Matplotlib documentation

Octave’s documentation describes xlabel as specifying the string used to label the x-axis of the current axis. Matplotlib’s set_xlabel takes a labelpad in points (default 4.0) and text properties as keyword arguments.

FAQ

How do I add a label to a MATLAB plot?

Call xlabel('text') and ylabel('text') after plotting, title('text') for a heading, and text(x,y,'text') for a label at a chosen point.

How do I put a subscript or Greek letter in an axis label?

Use TeX syntax in the default interpreter: _{ } for subscripts, ^{ } for superscripts and names such as alpha for Greek letters. For full equations use Interpreter "latex" with the text inside dollar signs.

How do I label every point on a scatter or line plot?

Pass vectors x and y and a cell array with one string per point to text.

How do I change the label font size or colour?

Add FontSize and Color as Name=Value pairs, for example xlabel("My Label",Color="red",FontSize=12). The default size is 11 points.

How do I label one subplot or tile?

Pass that axes as the first argument, for example xlabel(ax1,'Population').

Sources (official documentation)

MathWorks documentation pages read 2026-11-07; check the page for your installed release.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about MATLAB Plot Label: xlabel, ylabel, title and Point Labels

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →