AppDesigner: Is it possible to interactively stretch/schrink plots ("Axes") in x or y direction separately (NOT zoom in/out both)?

35 次查看(过去 30 天)
Dear Community,
I am developing a dialogue based application in Matlab using AppDesigner. In the dialogue several plots ("Axes" objects from the Component Library) are being used for visual inspection (and modification) of curves being analysed. Plots work fine, but curves are lengthy (contain a lot of points).
Question:
Is there any easy way (withoung using additional controls) to interactively zoom in/out curves to see individual points in ONE (x) direction only (i.e. stretch/shrink plots horizontally), without modifying the y axis (value range displayed)?
The built-in functionality of "Axes" enables zooming in/out (using +/- magnifying glass and/or mouse scroll wheel), but only in BOTH directions simultaneously (horizontally and vertically), so that points disappear from the field of view. "Pan" has no influence on the dynamic range of the displayed y values, so it is not a solution.
Any suggestions? Thank you very much in advance!

采纳的回答

Marek
Marek 2025-9-22,19:15
编辑:Marek 2025-9-24,5:57
I think I have found a solution - thank you for your comments and suggestions :)
The solution is to modify (activate/deactivate if necessary) "Axes" property as follows:
app.UIAxes.InteractionOptions.LimitsDimensions = "x";
EDIT:
In the above example zoom will be limited to x axis only. Similarly
app.UIAxes.InteractionOptions.LimitsDimensions = "y";
app.UIAxes.InteractionOptions.LimitsDimensions = "xy";
would restrict zoom to y, or xy axes (3D plots can be zoomed in xyz).
A bit "tricky" it to disable zoom at all. So far I have found the following workaround, but maybe there is a simpler way?:
app.UIAxes.Interactions = [panInteraction];
indirectly deactivates all xyz zoom axes and leaves "pan" active.
app.UIAxesOrg.Interactions = [zoomInteraction, panInteraction];
would activate both pan and zoom.

更多回答(1 个)

Matt J
Matt J 2025-9-22,18:24
编辑:Matt J 2025-9-22,18:26
This example looks applicable to you: Restrict Zooming to X-Dimension.

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

产品


版本

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by