MATLAB: How to use ‘axis tight’ with appdesigner

appdesigneraxis tightplot

Hi, I'm using app designer to display some simple plots, how do i use the 'axis tight' command within the app designer code for the integrated figure?
I've tried this, but its not working as I want:
plot(app.UIAxes, S, Prices);
title(app.UIAxes, 'Price');
axis tight
Thanks for any help in advance!

Best Answer

Hi Matt,
Try specifying which axis you want to be tight:
plot(app.UIAxes, S, Prices);
title(app.UIAxes, 'Price');
axis(app.UIAxes, 'tight');
I have a hunch that the problem may be that "axis tight" does not find app.UIAxes, so instead you need to specify which axis you want to be tight. You do that by calling axis(<axis you want>, 'tight');
For more information, see: axis
Hope this helps!