deadspace in UIaxes near image

Trying to create a clean looking GUI
Inserting image into UIaxes
there seems to always be dead space around the image that i dont understand (Shown below)
Trying to read the image size to resize UI axes but getting extra space on both sides.
Can someone check this ?
There seems to be 2 properteis UI figure and UI axes, am I using the right one (both in forms initilization)?
% Button pushed function: LoadImageFileButton
function openfile(app, event)
[file,path]=uigetfile({'*.jpg';'*.bmp';'*.gif';'*.tiff'}, 'Select file');
app.a= double(imread(file));
app.a= -(0.0316*app.a) +8.3;
app.b = app.a;
%app.UIAxes.Positon = [ 100 , 100 , size(app.a,1), size(app.a,2)]
app.UIAxes.Position = [400 100 size(app.a,1)/10 size(app.a,2)/10];
% app.UIFigure.Position = [100 100 size(app.a,1)/3 size(app.a,2)/3];
imagesc(app.a,'Parent',app.UIAxes);
colorbarupdate(app, event);
end

 採用された回答

ScottB
ScottB 2024 年 8 月 21 日
移動済み: Voss 2024 年 8 月 21 日

0 投票

You could try "axis tight".

4 件のコメント

Voss
Voss 2024 年 8 月 21 日
移動済み: Voss 2024 年 8 月 21 日
% ...
imagesc(app.a,'Parent',app.UIAxes);
axis(app.UIAxes,'tight')
% ...
JM
JM 2024 年 8 月 21 日
移動済み: Voss 2024 年 8 月 21 日
yes
this works
dont even need this part
% app.UIAxes.Position = [400 100 size(app.a,1)/10 size(app.a,2)/10];
JM
JM 2024 年 8 月 21 日
移動済み: Voss 2024 年 8 月 21 日
there is typically a button about "solution accepted" howeever, it is not there for this thread
Voss
Voss 2024 年 8 月 21 日
移動済み: Voss 2024 年 8 月 21 日
That's because these are comments, not answers.
I'll make ScottB's comment an answer and then you can accept it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2022a

タグ

質問済み:

JM
2024 年 8 月 21 日

編集済み:

2024 年 8 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by