suptitle — Set a title centered above the entire figure, especially for older MATLAB subplot code.
suptitle sets or updates the same figure-level title as sgtitle. It exists for compatibility with MATLAB code in the wild that uses the older helper name for subplot layouts. In RunMat, it targets the current figure by default or an explicit figure handle when one is passed, returns a text handle, and participates in get and set through the shared plotting property system.
How suptitle works
suptitle(txt)updates the current figure and returns the super-title text handle.suptitle(fig, txt, ...)targets an explicit figure handle when the handle exists.- String scalars, char arrays, string arrays, and cell arrays can all be used to create multiline super titles.
- Text styling properties such as
FontSize,FontWeight,FontAngle,Color,Interpreter, andVisibleuse the shared plotting text-property system. suptitleandsgtitleupdate the same figure-level title object.
Examples
Add a super title above a subplot figure
subplot(2, 1, 1);
plot(1:10, rand(1, 10));
subplot(2, 1, 2);
plot(1:10, rand(1, 10));
suptitle('Experiment Summary');Style the figure-level title and inspect the returned handle
subplot(1, 2, 1);
imagesc(peaks(20));
subplot(1, 2, 2);
imagesc(peaks(20));
h = suptitle('Field Comparison', 'FontSize', 18, 'FontWeight', 'bold');
get(h, 'Type')Expected output:
ans =
'text'Target an explicit figure handle
fig = figure(42);
subplot(1, 2, 1);
plot(0:0.1:1, sin(0:0.1:1));
subplot(1, 2, 2);
plot(0:0.1:1, cos(0:0.1:1));
suptitle(fig, 'Sine and Cosine');FAQ
How is suptitle different from sgtitle?⌄
In RunMat, suptitle and sgtitle update the same figure-level super title. suptitle is provided as a compatibility spelling for MATLAB code that uses the older helper name.
How is suptitle different from title?⌄
title attaches text to the current axes, so each subplot can have its own panel title. suptitle attaches text to the figure as a whole and is drawn once above all panels.
Can I update the super title after creating it?⌄
Yes. suptitle returns a text handle, so you can inspect or update it with get and set.
h = suptitle('Initial Title');
set(h, 'String', 'Updated Title', 'FontWeight', 'bold');Related Plotting functions
More plotting resources
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how suptitle works, line by line, in Rust.
- View suptitle.rs on GitHub
- Learn how the runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.
- Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
- Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
- A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.