How to set the defaultAxesFontSize for a Shared Axes Label

3 views (last 30 days)
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')

Answers (1)

Rijuta
Rijuta on 13 Sep 2023
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

Categories

Find more on Visual Exploration in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!