How do I view "hidden" contour lines on a surface?
조회 수: 2 (최근 30일)
이전 댓글 표시
The following Matlab code produces a 3d surface plot with a superimposed contour line. The resulting contour line has several missing segments. If I manually rotate the surface, I can see the missing segments behind the surface. Is there some way to make the entire contour line visible?
x=linspace(0,3,10); y=linspace(0,2,10);
z=[ 2.08, 2.04, 1.91, 1.64, 1.21, 0.74, 0.66, 0.55, 0.33, 0.00; 2.01, 1.87, 1.66, 1.39, 1.03, 0.73, 0.65, 0.47, 0.17, 0.00; 1.79, 1.68, 1.29, 1.11, 0.85, 0.73, 0.56, 0.20, 0.00, 0.00; 1.75, 1.62, 1.20, 0.99, 0.66, 0.59, 0.47, 0.00, 0.00, 0.00; 1.51, 1.35, 1.08, 0.67, 0.53, 0.57, 0.22, 0.00, 0.00, 0.00; 1.06, 0.81, 0.69, 0.38, 0.46, 0.40, 0.00, 0.00, 0.00, 0.00; 0.45, 0.38, 0.21, 0.12, 0.31, 0.04, 0.00, 0.00, 0.00, 0.00; 0.06, 0.04, 0.00, 0.01, 0.09, 0.00, 0.00, 0.00, 0.00, 0.00; 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00; 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00];
figure; surf(x, y, z); hold on
view(120,40); colormap(winter)
[C,h]=contour3(x, y, z, [1.0 1.0], 'r');
댓글 수: 0
답변 (1개)
John D'Errico
2014년 2월 27일
I'd suggest turning the surface mildly transparent. In the call to surf, try this instead:
surf(x, y, z,'facealpha',.5)
The rest stays the same.
댓글 수: 2
Walter Roberson
2014년 2월 27일
One effect of using transparency would be to force OpenGL renderer. But if that was not what was being used then just the switch of renderer might be the trick rather than the transparency itself. Try
set(gcf, 'Renderer', 'opengl')
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!