How do I view "hidden" contour lines on a surface?
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
John D'Errico
on 27 Feb 2014
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 Comments
Walter Roberson
on 27 Feb 2014
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')
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!