Display the exact selected area by zooming in on a surface/image
조회 수: 28 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Benjamin Kraus
2024년 8월 14일 18:31
편집: Benjamin Kraus
2024년 8월 14일 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
참고 항목
카테고리
Help Center 및 File Exchange에서 Visual Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!