surface disappears when zdata is set to 0
조회 수: 3 (최근 30일)
이전 댓글 표시
for some reason i want to set the zdata of a surface plot object to zero, keeping its color, and setting view point to [0 0 1] (looking at it from the top).
code used:
surfobjhandle=surf(X,Y,Z);
colordata=get(surfobjhandle,'cdata');
view([0 0 1]);
set(surfobjhandle,'zdata',zeros(size(get(surfobjhandle,'zdata'))));
set(surfobjhandle,'cdata',colordata);
however, this way the surface is not visible anymore with the viewpoint set to [0 0 1]. it only appears setting a different viewpoint which is not what i want. why is this?
댓글 수: 4
Jan
2012년 8월 29일
@Peter: If you had posted the test data I've asked for, the problem would have been solved faster, perhaps.
답변 (1개)
Kevin Moerman
2012년 8월 29일
This example is probably equivalent to what you want:
[X,Y,Z]=peaks(25); figure; surf(X,Y,zeros(size(Z)),Z) ; view(3); axis vis3d;
Perhaps you loose your plot because of axis tight? That sometimes crops too tightly. Also have a look at using the pcolor and imagesc commands instead.
Kevin
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!