How to set the defaultAxesFontSize for a Shared Axes Label

10 次查看(过去 30 天)
I can set the defaultAxesFontsize for my plots as:
set(groot,'defaultAxesFontSize' ,18);
This works for me in normal plots.
But this does not seem to affect the AxesFontSize if I use a tiled chart with a Shared Axes Label
t = tiledlayout(2,2,'TileSpacing','Compact');
xlabel(t,'Distance (mm)')
% Tile 1
nexttile
plot(rand(1,20))
title('Sample 1')
% Tile 2
nexttile
plot(rand(1,20))
title('Sample 2')

回答(1 个)

Rijuta
Rijuta 2023-9-13
Hi Hans,
I understand that you want to set the axes font size for a Shared Axes Label.
In your code, the `set(groot,'defaultAxesFontSize', 18)` command sets the default font size for axes in normal plots. However, it does not affect the font size of axes in tiled charts with shared axes labels.
To change the font size in this case, you can use the `AX` output argument of the `nexttile` function to access the axes object and modify its properties.
Kindly refer to the documentation to know more about setting the axes properties: https://www.mathworks.com/help/matlab/ref/nexttile.html - mw_182f5fd9-00a6-42df-b2d3-9f874f0bb759

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by