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

7 views (last 30 days)
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!

Accepted Answer

Marek
Marek on 22 Sep 2025
Edited: Marek on 24 Sep 2025
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.

More Answers (1)

Matt J
Matt J on 22 Sep 2025
Edited: Matt J on 22 Sep 2025
This example looks applicable to you: Restrict Zooming to X-Dimension.

Categories

Find more on Data Exploration in Help Center and File Exchange

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!