is it a bug?
조회 수: 1 (최근 30일)
이전 댓글 표시
In the following code, if view(2) or view(0,90) is defined before axis() which is not auto, then a default 3D figure will be plotted instead of flat 2D image. If view(2) or view(0,90) is defined after axis(), then it works. However, view(360,90) works before as well as after non-auto axis().
a=-1:0.1:1;
b=a;
[X,Y]=meshgrid(a,b);
Z=X.^2+Y.^2;
figure(1)
clf
surf(X,Y,Z),
%view(2), view(0,90) this does not work before axis() which is not auto
view(360,90), %this works before and after axis()
axis([X(1) X(end) Y(1) Y(end) min(min(Z)) max(max(Z))]),
%view(2), view(0,90) %this works after axis()
grid on
댓글 수: 0
답변 (1개)
Nicolas B.
2019년 7월 17일
I have also experienced what you described. After investigation, even if it is not in the function documentation, the code of the function axis() resets the view of the plot to the default values. So no, it's not a bug, just an undocumented feature of the axis() function.
Therefore, I would recommend you to call axis() function before calling view().
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!