# Combining a 3D plot and a RegionPlot

Let's say I have a cuboid like

a = Graphics3D[{Opacity[0.2], Cuboid[{-1, -4, 0}, {5, 5, 0.001}]},
Lighting -> {Darker[Gray]}, BoxRatios -> {.8, .7, .2},
ViewPoint -> {1, 0, .8}, ImageSize -> 52 6,
PlotRange -> {{-1, 5}, {-4, 4}, {0, 1.05}}];

b = Graphics3D[{Opacity[0.2], Cuboid[{-1, 4, 0}, {5, 5, 5}]},
Lighting -> {Darker[Gray]}, BoxRatios -> {.8, .7, .2},
ViewPoint -> {1, 0, .8}, ImageSize -> 52 6,
PlotRange -> {{-1, 5}, {-4, 4}, {0, 1.05}}];

c = Graphics3D[{Opacity[0.2], Cuboid[{-1, -4, 0}, {-1, 5, 5}]},
Lighting -> {Darker[Gray]}, BoxRatios -> {.8, .7, .2},
ViewPoint -> {1, 0, .8}, ImageSize -> 52 6,
PlotRange -> {{-1, 5}, {-4, 4}, {0, 1.05}}];

d = Graphics3D[{Opacity[0.2], Cuboid[{-1, -4, 0}, {5, -4, 5}]},
Lighting -> {Darker[Gray]}, BoxRatios -> {.8, .7, .2},
ViewPoint -> {1, 0, .8}, ImageSize -> 52 6,
PlotRange -> {{-1, 5}, {-4, 4}, {0, 1.05}}];

Show[a, b, c, d]


and need to combine the cuboid with this:

a1 = RegionPlot3D[
x > y^2/n0^2 + c t && Abs[z] < 0.001, {x, -2, 70}, {y, -4, 4}, {z,
0, 1}, Mesh -> None, PlotPoints -> 101, Lighting -> {LightPink}]


so I do this:

Show[a, b, c, d, a1,
BoxRatios -> {.8, .7, .2},
PlotRange -> {{-1, 5}, {-4, 4}, {0, 1.05}},
ViewPoint -> {1, 0, .8}, ImageSize -> 52 6]


However, the light pink curve did not show up. It seems like it overlapped with the gray colour of the cuboid surface. How do I make the final 3D plot show that pink filling while the other surface is kept gray?

One way:

a = ParametricPlot3D[{y^2/n0^2 + c t, y, 0}, {y, -4, 4},
PlotStyle -> {Thick, Black}];
b = RegionPlot3D[
x > y^2/n0^2 + c t && Abs[z] < 0.01, {x, -2, 70}, {y, -4,
4}, {z, -2, 2}, Mesh -> None, PlotPoints -> 101];
Show[a, b, ImageSize -> Large]


You can reduce PlotPoints if you want, just make sure you use an odd number.

• Great! Thanks a lot !
– ssa
Oct 17, 2016 at 11:00

Not clear on what you meant by under the curve. However this may be what you are looking for. The filling is from the curve to the horizontal plane.

  n0 = 5/10; c = 132671/100000; t = 0;
c = ParametricPlot3D[{y^2/n0^2 + c t, y, 0}, {y, -4, 4},
PlotStyle -> {Black, Thick}];

s = ParametricPlot3D[
Evaluate[{y^2/n0^2 + c t, y, 0} v + {y^2/n0^2 + c t,
y, -3} (1 - v)], {y, -4, 4}, {v, 0, 1}, Mesh -> None,
PlotStyle -> Opacity[0.7]];

Show[{s, c}]