How to set the title font of a tiled chart layout (R2022b)?
16 views (last 30 days)
Show older comments
MathWorks Support Team
on 25 Jul 2023
Answered: MathWorks Support Team
on 26 Jul 2023
I have a tiled layout plot using the "tiledlayout" function in MATLAB R2022b. How can I set the font style and font size of the title of that plot?
Accepted Answer
MathWorks Support Team
on 25 Jul 2023
You can set the default title font of a Tiled Layout plot configuration in MATLAB by using the ‘Title’ property of the ‘TiledChartLayout’ object.
Here is an example:
% Create a Tiled Chart Layout with a 2-by-2 grid of plots
t = tiledlayout(2,2);
% Set the default font size of the title
t.Title.FontSize = 14;
% Set the default font style of the title
t.Title.FontName = 'Times';
% t.Title.FontName = 'Arial';
% t.Title.FontName = 'Gotham';
% t.Title.FontName = 'Lucida Bright';
% Add some plots to the layout
nexttile
plot(1:10)
nexttile
plot(1:10)
nexttile
plot(1:10)
nexttile
plot(1:10)
% Add a title to the layout
title(t, 'My Tiled Layout')
In this example, the ‘Title’ property of the ‘t’ object (which is a ‘TiledChartLayout’ object) is used to set the default font size and font style of the title. You can change the font size/style to whatever value/option you prefer. The ‘title’ function is used to add a title to the entire layout.
For a full list of available fonts on your system, please use the "listfonts" function, as explained in the following MathWorks documentation page:
Please refer to the link below for more information on the ‘TiledChartLayout’ properties:
0 Comments
More Answers (0)
See Also
Categories
Find more on Labels and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!