Incorrect axes limits after using tight_subplot

2 Ansichten (letzte 30 Tage)
Karthik Nagarajan
Karthik Nagarajan am 20 Apr. 2021
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?

Antworten (0)

Kategorien

Mehr zu Model, Block, and Port Callbacks finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by