Need help understanding stretch-to-fit associated behavior
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Rik
il 21 Feb 2017
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.
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!