3D Surface plot - Surfc - alternate contour plane

1 view (last 30 days)
I am trying to plot a 3D surface and a contour plot. This can be done by the surfc () command - which projects the top view contours onto the bottom plane, (i.e. the XY plane) However I need to project side view contours onto a side view plane (i.e the XZ or YZ plane). Can anyone help? Also I am wanting to be able to control the number and resolution of the contour levels.

Answers (1)

Adam Filion
Adam Filion on 25 Jun 2012
I'm not familiar with any way to directly take side view projections, but you can always flip your inputs to SURFC to get the projections you want, i.e.
[x,y,z] = peaks;
% x-y plane projection
surfc(x,y,z)
% x-z plane projection
surfc(x,z,y)
% y-z plane projections
surfc(y,z,x)
The SURFC command uses CONTOUR3 under the hood (you can see the source code by entering ‘edit surfc’ at the command line), and uses the default contour levels. As SURFC doesn’t return a handle to the contour levels, I don’t know of a simple way to change them. You could ways use the GET and SET commands to query and set the contours, but I would recommend making your own copy of SURFC (do not save over the shipping version) that will accept additional inputs so you could control the contours yourself by inputting them to CONTOUR3 inside of MY_SURFC.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!