# Mathematica , Combining 2D and 3D plots

1. Aug 11, 2011

### PeetPb

Hi,

I was thinking if there is a way to combine 2D and 3D plots in mathematica. I mean, for example I have a curve on the XY plane and I want to combine it with a graph of a surface, so to have that curve under the surface. The other case , to combine a 2D vector field with a surface .. something like http://en.wikipedia.org/wiki/File:Gradient99.png" [Broken]
Any Ideas ?

thanks

Last edited by a moderator: May 5, 2017
2. Aug 11, 2011

### Staff: Mentor

Hi PeetPb, welcome to PF!

The key is that you cannot Show 2D and 3D graphics together. So you have to use the 2D graphic as a Texture for a 3D polygon. Then you Show those two objects together.

Show[Plot3D[Sin[x], {x, -\[Pi], \[Pi]}, {y, -1, 1}],
Graphics3D[{Texture[Plot[Cos[x], {x, -\[Pi], \[Pi]}]],
Polygon[{{-\[Pi], -1, 0}, {\[Pi], -1, 0}, {\[Pi], 1, 0}, {-\[Pi],
1, 0}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0,
1}}]}, Lighting -> "Neutral"]]

3. Aug 11, 2011

### PeetPb

Thanks ... for both :-) ... I really need this and I couldn't find a way to show 2d and 3d graph, and when I finally made something up the 2d graph was right in the middle of the 3d plot and had it's own axis .... anyway thank you very much it helped me very much :)

I actually found out a way how to "combine" a parametric curve and a surface

ParametricPlot3D[{{x, y, Cos[2 x + y]}, {x, x^2, -1}}, {x, 0, 2}, {y,
0, 2}, BoxRatios -> {1, 1, 1}]