Stop user from dragging off data in uiaxes, set 'Restore View' Properly

6 ビュー (過去 30 日間)
Kylie MacFarquharson
Kylie MacFarquharson 2019 年 7 月 11 日
回答済み: Maadhav Akula 2019 年 7 月 17 日
I'm trying to transition over to app designer but am having trouble with uiaxes objects. When I use imagesc with a uiaxes object, the automatic limits are badly choses, leaving data off screen in one direction and whitespace on the others. Standard (axes) behavior has the limits automatically set properly and won't let the user drag beyond where there is data.
How to I acheive this in uiaxes. Is there a workaround?
Minimum broken example:
C = magic(3);
ax = uiaxes();
im = imagesc(ax,C);
You can drag beyond the limits!

回答 (1 件)

Maadhav Akula
Maadhav Akula 2019 年 7 月 17 日
I understand from your question that you either want to autoscale the axes limits (or) want to disable the interactivity of the UIAxes.
For autoscaling:
C = magic(3);
ax = app.UIAxes;
axis (ax,'tight')
im = imagesc(ax,C);
For disabling interactivity of the UIAxes component:
disableDefaultInteractivity(ax)
You can also hide the toolbar so that the user cannot zoom in/out:
ax.Toolbar.Visible = 'off';

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by