MATLAB Answers

How to remove the white blank in Axes when using the imagesc function in the Appdesigner?

123 views (last 30 days)
apple on 9 May 2019
Commented: apple on 10 May 2019
I am using the imagesc to show the following 'z' in the Axes when using app designer.How to remove the white blank generated in image drawn using imagesc?
x = (100:200)';
y = (0:.1:20)+ 30;
z = sind(x*y)+x*y/1000;
% plot:


Jan on 9 May 2019
Do you mean the space between the image and the border of the axes, or between the axes and the figure?
Adam Danz
Adam Danz on 9 May 2019
I'm assuming it's between the image and axes since 1) the default behavior for imagesc with regular figures is for the axis limits to match the data (ie, no white space) but this is not true in appdesigner axes and 2) there is no space between axes and figures in appdesigner unless the OP wants to change the color of the entire app background.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 9 May 2019
Edited: Adam Danz on 9 May 2019
Option 1: tight axes
The easiest solution would be to set the axes to 'tight'.
axis(app.UIAxes, 'tight')
Option 2: set x/ylim
Alternatively, you could set the x and y axis limits to the max/min of your data.
xlim(app.UIAxes, [min(x(:)), max(x(:))])
ylim(app.UIAxes, [min(y(:)), max(y(:))])

More Answers (0)