Need help understanding stretch-to-fit associated behavior
2 次查看(过去 30 天)
显示 更早的评论
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
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.
采纳的回答
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!