Display the exact selected area by zooming in on a surface/image
28 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have an uiaxes on a GUI (appdesigner) on which I draw a 2D surface with axis equal. When I zoom in by selecting an area, I'd like the area displayed to correspond exactly to the one selected (no more, no less). I had this behavior with MATLAB 2019/2020. However, since upgrading to version 2024, I've been able to zoom in, but the initial width/length aspect ratio of the displayed surface remains unchanged. As the background isn't clickable, elongated surfaces are very difficult to manage.
Here's an illustration and an attached .fig. I've tried changing the daspect and DataAspectRatioMode, but couldn't get it right.
If anyone has a solution, I'd love to hear from you!
Thanks in advance.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1720656/image.png)
0 comentarios
Respuestas (1)
Benjamin Kraus
el 14 de Ag. de 2024 a las 18:31
Editada: Benjamin Kraus
el 14 de Ag. de 2024 a las 18:33
I downloaded your FIG-file, and it looks like the axes inside has a manually specified DataAspectRatio and PlotBoxAspectRatio. When you zoom, you are also setting manual XLim and YLim, leaving an overconstrained system. MATLAB cannot honor the all four constraints at the same time, so it is ignoring some of them.
This documentation page has some details about this collection of properties and how they behave and interact with one another: Manipulating Axes Aspect Ratio
I'm not sure why this table was removed from the documentation, but if you look at a really old version of the documentation, there is a table that shows how MATLAB responds when you set all of those properties. For example, search on this page for the words "Limits and DataAspectRatio are honored".
The other possibility is that the axes is being resized in a way you don't expect, but because you have the background set to transparent you don't notice. As an experiment, I suggest turning on the axes (set the background back to white) and see if that helps you understand what is happening.
0 comentarios
Ver también
Categorías
Más información sobre Visual Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!