필터 지우기
필터 지우기

Display the exact selected area by zooming in on a surface/image

조회 수: 28 (최근 30일)
Kevin Daigne
Kevin Daigne 2024년 6월 22일
편집: Benjamin Kraus 2024년 8월 14일 18:33
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.

답변 (1개)

Benjamin Kraus
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.

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by