Control axes size in tiledlayout
Show older comments
Hi people,
How can I control the axes size in a tiledlayout and keep it identical for different figures with the same tiledlayout but different data?
So far, the plots in my tiles seem to resize automatically, presumably influenced by their axis texts such as labels and ticks. I would like to be able to get axes in the same tiles with identical axes sizes, independent of axes texts, to arrange them nicely in documents when I save the figures.
Consider this example with different magnitudes on the axes ticks:
x = linspace(0,5,40);
y = x.^2;
yy = y.^3;
figure
layout = tiledlayout(1,5);
layout.TileSpacing = 'tight';
nexttile([1 1])
boxplot(y)
grid on
ylabel('$y_i$ [g/l]', 'Interpreter', 'latex')
xlabel('$t$ [d]', 'Interpreter', 'latex')
nexttile([1 4])
plot(x,y)
grid on
ylabel('$y_i$ [g/l]', 'Interpreter', 'latex')
xlabel('$t$ [d]', 'Interpreter', 'latex')
figure
layout = tiledlayout(1,5);
layout.TileSpacing = 'tight';
tiledlayout(1, 5)
nexttile([1 1])
boxplot(yy)
grid on
ylabel('$yy_i$ [g/l]', 'Interpreter', 'latex')
xlabel('$t$ [d]', 'Interpreter', 'latex')
nexttile([1 4])
plot(x,yy)
grid on
ylabel('$yy_i$ [g/l]', 'Interpreter', 'latex')
xlabel('$t$ [d]', 'Interpreter', 'latex')
I create two figures, each with a similar plot and identical tiledlayout. The whole tiles are the same size in both figures. However, the axes that are labelled with larger texts are smaller in the second figure. How can I set the same size for all axes in these tiles respectively? They can be the smaller size that accomodates for the largest text sizes.
Edit:
Here's a picture of the size difference I am talking about:

Cheers
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!