I would like to plot a real-valued function $f$ of two real variables $x,y$ but only over the region of the $x$-$y$ plane satisfying \begin{align} x>0, \qquad -x^{3/2} < y < x^{3/2}. \end{align} Is there a straightforward way to do this using Plot3D?


RegionFunction option is what you're looking for:

Plot3D[Cos[x] + Sin[y], {x, -1, 5}, {y, -5, 5},
 RegionFunction -> (#1 > 0 && - #1^(3/2) < #2 < #1^(3/2) &)]


The arguments provided to the function vary a bit depending on which plot function you are using, you can see under "Details" in the documentation. ("More Information" in older versions)

  • $\begingroup$ Perfect thanks! $\endgroup$ – joshphysics Sep 13 '13 at 0:01

The second iterator (for y) may depend on the first:

Plot3D[Cos[x] + Sin[y], {x, 0, 5}, {y, -x^(3/2), x^(3/2)}]

Mathematica graphics


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.