How to set the defaultAxesFontSize for a Shared Axes Label

10 ビュー (過去 30 日間)
hans
hans 2022 年 1 月 10 日
回答済み: Rijuta 2023 年 9 月 13 日
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 Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by