Is it possible to set the default font size for shared axis labels in Tiled Layouts?

7 ビュー (過去 30 日間)
Nathan Li
Nathan Li 2021 年 6 月 6 日
コメント済み: Marco Kendlbacher 2023 年 2 月 23 日
I tried the following code, but it does not affect the font size for shared titles and axis labels in TiledChartLayout objects.
set(groot,'defaultAxesFontSize',16);
t = tiledlayout(2,1);
t.XLabel.String = 'x-axis label';
t.YLabel.String = 'y-axis label';
t.Title.String = 'title';
nexttile();
plot(1:10);
nexttile();
plot(1:10);
plot generated from above code
I also tried to set default properties for Text objects because the XLabel and YLabel properties of TiledLayoutChart objects are Text objects,
set(groot,'defaultTextFontSizeMode','manual');
set(groot,'defaultTextFontSize',16);
but these 2 lines did not affect any of the text in the example figure shown above. I double-checked default values for groot and called
reset(groot);
to make sure that no other default property values defined by me could potentially conflict with the example code shown above.
  1 件のコメント
Marco Kendlbacher
Marco Kendlbacher 2023 年 2 月 23 日
Just additionally use
set(groot,'defaultAxesFontSizeMode','manual');
with the specification of the 'defaultTextFontSizeMode' to 'manual'. Then it maybe should work fine.
So maybe
myfontsize = 16;
set(groot,'defaultAxesFontSizeMode','manual')
set(groot,'defaultTextFontSizeMode','manual')
set(groot,'defaultAxesFontSize',myfontsize)
set(groot,'defaultTextFontSize',myfontsize)
should do the trick.

サインインしてコメントする。

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 6 日
Use this instead:
set(gca, 'FontSize', 16.0);

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by