Incorrect axes limits after using tight_subplot

2 views (last 30 days)
Dear all,
I am encountering an issue querying the axis 'ylim' property when using the tight_subplot function (https://www.mathworks.com/matlabcentral/fileexchange/27991-tight_subplot-nh-nw-gap-marg_h-marg_w) from the File Exchange in MATLAB R2021a. My code is the following:
clear;clc;clf;
close all hidden;
set(gcf,'OuterPosition',[200 200 350 350]);
[ha,pos]=tight_subplot(1,1,[.10 .12],[.16 .08],[.14 .06]);
axes(ha(1));
plot([0 1 2],[0 34.8 0])
get(gca,'ylim')
The result in the command window upon executing the above code is
ans =
0 35
However, the plot produced is as follows:
When I type the last command 'get(gca,'ylim')' manually in the command window after executing the above code, I do obtain 0 and 40 as the y axis limits as expected. Could someone please explain why the original attempt to query the y axis limit in the above code segment produced the incorrect result?

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!