How can I make the default LabelFontSize work also for a tiledlayout ?

How can I make the default LabelFontSize work also for a tiledlayout ?
The setting which works for nomal plots does not work for me in tiledlayout
For illustration, compare the correct font size for xlabel and ylabel in Sample 0 and the small font size in Sample 1 and Sample 2
set(groot,'defaultAxesFontSize' ,24);
set(groot,'defaultTextFontSize' ,24);
set(groot,'defaultAxesTitleFontSizeMultiplier' ,1);
set(groot,'defaultAxesLabelFontSizeMultiplier' ,1.2);
% Here the label size is set as expected
figure('Position', [0 100 500 500]); r=axes;
plot(r,rand(1,20)); title('Sample 0');
xlabel(r,'Distance (mm)'); ylabel(r,'Amplitude (mm)');
% Here the label size is NOT set
figure('Position', [550 100 1000 500])
t = tiledlayout(1,2,'TileSpacing','Compact');
nexttile; plot(rand(1,20)); title('Sample 1');
nexttile; plot(rand(1,20)); title('Sample 2');
xlabel(t,'Distance (mm)'); ylabel(t,'Amplitude (mm)');

6 Comments

When x/y labels are assigned to the TiledChartLayout object, their fontsize is not defined by the defaultAxesFontSize or the defaultAxesLabelFontSizeMultiplier. I browsed the default settings and didn't see an option for setting fontsize for x/y labels assigned to TiledLayout, although there are settings to define the default text labels.
defaultTiledlayoutXLabel
defaultTiledlayoutYLabel
Thank You for looking into my question.
What do You mean, when You mention "defaultTiledlayoutXLabel" "defaultTiledlayoutYLabel" ? Do You suggest using these terms? It seems to me, Matlab does not know them.
Those terms set the default x/y labels text when the labels are assinged in tiledlayout. For example,
set(groot, 'defaultTiledlayoutXLabel', 'MyDefaultLabel')
set(groot,'defaultTiledlayoutXLabel','remove') % to remove the default
They don't affect the fontsize. I only mentioned them to show that I found some default settings that affect x/y labels used in tiledlayout but I did not find the settings that affect fontsize.
So no, I'm not suggesting you use them for this question.
Ok,
thank You., @Adam Danz
So the solution of my problem is still uncovered by Matlab.
I don't think there is a default setting for x/y labels assigned to TiledChartLayout objects.
You can, of course, assign the fontsize directly using,
xlabel(t,'Distance (mm)', 'FontSize', 24)
or instead of 24, get(groot, 'defaultAxesFontSize') but that won't use the defaultAxesLabelFontSizeMultiplier value.
Yes, I can set them everywhere individually.
Thank You.

Sign in to comment.

Answers (0)

Products

Release

R2021b

Asked:

on 12 Jan 2022

Commented:

on 13 Jan 2022

Community Treasure Hunt

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

Start Hunting!