# Add a contour plot on the xy plane of a 3D plot [duplicate]

I have this:

f[x_, y_] := x^2/(x^2 + y^2)
Plot3D[f[x, y], {x, -3, 3}, {y, -3, 3},
PlotStyle -> Opacity[.8],
MeshFunctions -> {#3 &}, PlotPoints -> 100,
AxesLabel -> {x, y},
Ticks -> {Range[-3, 3], Range[-3, 3]},
FaceGrids -> {{{0, 0, -1}, {Range[-3, 3], Range[-3, 3]}}}]


Which gives the following image: Now, I want to add a 2D contour plot on the xy-plane below the surface of f. Does anyone have a suggestion?

• @Michael E2: Definitely a duplicate. I tried searching for something like your link, but was not luck to find it. Thanks for the link. – David Dec 15 '14 at 0:07
• It's not always easy to know what terms to search for. I knew about that one, and I think you're not the first to ask about again. Cheers :) – Michael E2 Dec 15 '14 at 0:09
• @Michael E2: I'm afraid the procedures at mathematica.stackexchange.com/questions/14863/… are extremely difficult to understand. I am having huge difficulty trying to figure out what is going on, and therefore I think those solutions would not be appropriate for my students (new to Mathematica). Just too hard. Need an easier approach. – David Dec 15 '14 at 5:06
• Vitaliy's second approach is to pick a level and append it as a 3rd coord. to the contour plot. That seems slightly easier to learn (imo) than the texture method, although the texture one is about as close to a built-in method to embedding a 2D plane in 3D that there is. This is about as simple as it gets: cplot3d = Graphics3D[Cases[cplot, GraphicsComplex[pts_, rest__] :> GraphicsComplex[Append[#, level] & /@ pts, rest]]] where cplot is the ContourPlot and level is chosen/calculated appropriately. Combine with plot3d with Show[plot3d, cplot3d, PlotRange -> All].... – Michael E2 Dec 15 '14 at 11:36
• (cont'd)...Perhaps combining 2D and 3D graphics is not appropriate for your students. Here's another way: cplot3d = Plot3D[level, {x, -1.2, 1.2}, {y, -1.2, 1.2}, MeshFunctions -> {f[#1, #2] &}]. You'll need to set explicit numbers for Mesh in both plots to get the contours to match (e.g. Mesh -> {Range[0,1,0.1]}). Also related: 7772. – Michael E2 Dec 15 '14 at 11:43