필터 지우기
필터 지우기

Need help understanding stretch-to-fit associated behavior

조회 수: 4 (최근 30일)
Evan
Evan 2017년 2월 21일
답변: Evan 2017년 3월 18일
Matlab documentation states that when stretch-to-fill is enabled (as it is by default), then "the axes might not exactly match the data aspect ratio, plot box aspect ratio, and camera-view angle values stored in its DataAspectRatio, PlotBoxAspectRatio, and CameraViewAngle properties." Setting the 'mode' of any one of these three properties to 'manual' should turn off stretch-to-fill. It makes sense then, that if I make a plot and then set DataAspectRatioMode to manual:
figure;plot(0.1:0.1:pi,sin(0.1:0.1:pi))
daspect manual
Then the physical appearance of the plot should change, as stretch-to-fit has been turned off and the DataAspectRatio property is now accurate. It also makes sense that if I make the same plot and set PlotBoxAspectRatioMode to manual, then the values of DataAspectRatio should change (they do), as Matlab needs to make consistent the fact that (1) I've frozen the axis lims and (2) stretch-to-fit is turned off:
figure;plot(0.1:0.1:pi,sin(0.1:0.1:pi))
daspect
pbaspect manual
daspect
However, I do not understand why if I then set DataAspectRatioMode to manual, the plot changes again:
figure;plot(0.1:0.1:pi,sin(0.1:0.1:pi))
daspect
pbaspect manual
daspect
daspect manual
daspect
In fact, if you look at the plot, the behavior is as if setting the DataAspectRatioMode to manual in this context sets the axis limits to 'tight.' Does anyone know why this happens?
  댓글 수: 1
Rik
Rik 2017년 2월 21일
I'll be interested in the answer as well. Sometimes it is difficult to see the logic behind certain behavior of Matlab, and in my experience axes and figures are the most difficult to understand.

댓글을 달려면 로그인하십시오.

채택된 답변

Evan
Evan 2017년 3월 18일
Answer is here. When LimitModes are auto while DataAspectRatioMode and PlotBoxAspectRatioMode are manual, "MATLAB chooses limits that completely fit and center the plot within the specified PlotBoxAspectRatio given the specified DataAspectRatio."

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Formatting and Annotation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by