Using zoom with rectangle cuts of area

6 views (last 30 days)
Rolf
Rolf on 13 Nov 2023
Edited: Matt J on 13 Nov 2023
In an application, I am using the zoom function to enable zooming by user interaction.
Sometimes when using the rectangular click & drag region I run into the problem, that the zoomed imag cuts off parts of the box's content. When the ratio of the box and the axes are not the same it makes sense that the zoomed imaged cannot contain exactly the selected region. But I would prefered it in that case that the zoomed image would add some padding around the selection to fit into the axes instead of cutting parts away. In other words, the zoomed image should always contain AT LEAST the selected region, if necessary it can show more but never less.
The behaviour occures in R2022b, in an older version of the same application running in R2015b I never had the problem. Is there any way to make the zoom box to behave as I want it to?

Answers (1)

Matt J
Matt J on 13 Nov 2023
Edited: Matt J on 13 Nov 2023
Don't use zoom. Use XLim and YLim to control the viewable region. That will let you set its boundaries exactly as you like them.

Categories

Find more on Data Exploration in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!