# Adding contour lines to a 3D plot?

I am having trouble getting contour lines on a 3D plot (ListPlot3D). I have tried ListContourPlot3D, but that gives me a really weird looking graph with a ton of dfferent levels. What I would like is to get Contour lines on my ListPlot3D so it looks like a topo-map or something. As of now I have a contour map and a 3D plot - in essence I would like to combine them. Here is what the notebook currently looks like:

-
Closely related question: can the color in MeshStyle be specified by a ColorFunction –  Jens Jan 26 '13 at 6:06

You are looking for MeshFunctions -> {#3 &}. The documentation for MeshFunctions lays out what values are accessible by a plot that uses MeshFunctions and its defaults in the Details section.

As to why ListContourPlot3D was not working for this: its purpose is entirely different. It is intended to draw contours for an $\mathbb{R}^3 \to \mathbb{R}$ function, such as $f(x, y, z) = x^2 + y^2 - z^2$.

-
This is an unusual URL: wolfram.com/xid/0i1q1qqc4-mvz -- where did it come from? –  Mr.Wizard Jan 25 '13 at 21:32
@Mr.Wizard on the examples, click on the "In" and the URL is in the pop-up. Rm pointed out how to do it awhile back. –  rcollyer Jan 25 '13 at 23:54
@Mr.Wizard you get an empty pop-up where? on the website? –  rcollyer Jan 25 '13 at 23:56
It seems I misunderstood. I thought this was in the help Notebooks but I see it is on the Web copy. I knew that the code was there to copy but I've never noticed the URL at the bottom. Thanks! –  Mr.Wizard Jan 25 '13 at 23:58

Here is a method to obtain nice 2D contour plots using the Presentations Application (which I have a propriatary interest in). I don't have access to your data so I am using a regular function as an example.

<< Presentations

Draw3DItems[
{ContourDraw[Sin[x] + Sin[y], {x, -5, 5}, {y, -5, 5},
ColorFunction -> ColorData["StarryNightColors"]] //
RaiseTo3D[Sin[#1] + Sin[#2] &]},
NeutralLighting[0, .5, .1],
NiceRotation,
ImageSize -> 400]


The Presentations drawing commands allow us to deal directly with the graphics primitives and RaiseTo3D is a Presentations routine that does what it says. NaturalLighting is similar to the Mathematica Neutral Lighting, but gives much more control. NiceRotation gives mouse rotations without jumpings. Here is the graphic:

And in the notebook the contour lines even have Tooltips.

-
How is this better than the default methods? Here you have to enter the function twice. Isn't it easier to just use Plot3D[Sin[x] + Sin[y], {x, -5, 5}, {y, -5, 5}, MeshFunctions -> {#3 &}, Mesh -> 7, ColorFunction -> ColorData["StarryNightColors"]]` ? –  Mr.Wizard Jan 28 '13 at 19:37
@Mr.Wizard There are two things that are better. This is a true contour plot with distinct colors between the contours. Also, using a true contour plot, it is possible to better specify the contour values and obtain distinct coloring in each region using the ContourColors function in Presentations. For example, one might want a number of closely valued contour lines in a plateau region. The Mesh method has mesh lines on top of a general shading. Secondly, the contours have tooltips, whereas the Mesh lines don't. I agree that for many cases the Mesh method might be sufficient. –  David Park Jan 28 '13 at 19:57