# Color of the volume under the surface

Suppose there is the function Exp[-(x^2+y^2)] which covers a certain volume under its surface. That can be easily illustrated by

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}].

How can I split the volume under the surface into two pieces and color them differently?

I'm trying something like

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, RegionFunction -> Function[{x, y, z}, x + y < 0]]

which leaves just one part of the split volume.

• Are you looking to actually color the volume under the surface (e.g. between surface and the xy-plane), or are you simply trying to color the surface itself in two different colors (one for each region/piece)? Commented Jan 7, 2023 at 11:01
• The first mentioned option: the volume under the surface and xy plane. Commented Jan 7, 2023 at 11:15
• mathematica.stackexchange.com/questions/262896/… Commented Jan 7, 2023 at 11:45

Show[MapThread[RegionPlot3D[Exp[-(x^2 + y^2)] - z > 0 && #1
, {x, -2, 2}, {y, -2, 2}, {z, 0, 1.2}
, PlotPoints -> 60
, MaxRecursion -> 4
, Mesh -> 3
, MeshStyle -> #2
, PlotStyle -> Directive[Opacity[0.5], Lighter@#2]
] &
, {{x + y < 0, x + y >= 0}, {Red, Blue}
}
]
]


Something like:

Plot3D[{Exp[-(x^2 + y^2)]}, {x, -2, 2}, {y, -2, 2},
RegionFunction -> Function[{x, y, z}, x + y < 0], Filling -> Bottom,
FillingStyle -> Green]