4
$\begingroup$

I'm trying to plot inundation at different elevations on a 3D ground surface elevation plot. The closest I have got so far has been to use FillingStyle as the following simple example shows:

ListPlot3D[Table[Sin[j^2 + i], {i, 0, Pi, 0.1}, {j, 0, Pi, 0.1}], Filling -> 0, FillingStyle -> {Blue, None}]

enter image description here

But I want the water to be shown only on the ground. In other words, I want the filling operation to be done only when the surface is lower than the filling plane (z=0 in this example). Any ideas how to do that?

Thanks in advance.

$\endgroup$
5
$\begingroup$
table = Table[Sin[j^2 + i], {i, 0, Pi, 0.1}, {j, 0, Pi, 0.1}];

Show[ListPlot3D[table],
 ListPlot3D[table, Filling -> 0, RegionFunction -> (#3 <= 0 &), FillingStyle -> Blue]]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Perfect! Thanks for the quick answer. $\endgroup$ – MathX May 22 '16 at 23:01
  • $\begingroup$ @MathX, my pleasure. Thank you for the Accept. $\endgroup$ – kglr May 22 '16 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.