# Combine 2D Plot with 3D Plot

I want to combine 2D Plot with 3D Plot, where the 2D Plot should be placed on one of the "walls" of the 3D Plot. I have used an idea from this answer and ended with something like that (where the functions are only some example without a meaning)

p1 = Plot3D[Sin[d+s] - Cos[s], {s, 0, Pi}, {d, 0, Pi},
PlotRange -> {0, 1}, AxesLabel -> {"s", "d", "Sin[d+s]-Cos[s]"},
AxesStyle -> Directive[Black, 20]];
p2 = Plot[{(t/Pi)^2, Sqrt[t/Pi]}, {t, 0, Pi},
PlotStyle -> {Black, Blue}];
p3 = Graphics3D @@ (FullGraphics[p2] /.
Line[pts__] :> Line[pts /. {s_, d_} :> {s, 0, d}]);
Show[p1, p3]


I think the plot I obtain is fine, however, I got also some Axes and Ticks errors and the whole background is red, even if I turn the errors off.

What do I wrong?

• The problem comes from FullGraphics[p2]. p2 is a list of length 2. The first elements contains all the graphics primitives, the second the options. FullGraphics has problems with the options. Therefore, write FullGraphics[p2[[1]]] Oct 29, 2020 at 12:04
• Great, it works! Many thanks! Oct 29, 2020 at 12:07

We can also directly draw the two 3D curves by use ParametricPlot3D,

{x, y, z} /. {x -> t, y -> 0, z -> (t/Pi)^2}
{x, y, z} /. {x -> t, y -> 0, z -> Sqrt[t/Pi]}

p1 = Plot3D[Sin[d + s] - Cos[s], {s, 0, Pi}, {d, 0, Pi},
PlotRange -> {0, 1}, AxesLabel -> {"s", "d", "Sin[d+s]-Cos[s]"},
AxesStyle -> Directive[Black, 20]];
p4 =
ParametricPlot3D[{{x, y, z} /. {x -> t, y -> 0, z -> (t/Pi)^2}, {x,
y, z} /. {x -> t, y -> 0, z -> Sqrt[t/Pi]}}, {t, 0, Pi},
PlotStyle -> {Black, Blue}];
Show[p1, p4]