How can I exclude a region in a 3D plot?

I have done it for a Density plot, but for the 3D case, it seems difficult to exclude a region (with a certain relation between two main parameters). In fact, the 3D plot is for a relation in terms of "a" and "b", and each one of these parameters has a limitation. I want to denote the area of banned values of "a" and "b" (which is an inequality relation between these parameters) by a red boundary in the main 3D plot.


closed as off-topic by Sektor, m_goldberg, gwr, José Antonio Díaz Navas, LCarvalho Mar 9 '18 at 20:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Sektor, m_goldberg, gwr, José Antonio Díaz Navas, LCarvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ It is easier to help, if you provide code with your own attempt as a starting point and an example figure illustrating what you want to achieve. $\endgroup$ – Johu Mar 9 '18 at 10:58
  • 2
    $\begingroup$ Use the option RegionFunction for Plot3D as shown in the documentation. $\endgroup$ – gwr Mar 9 '18 at 11:07
  • $\begingroup$ Even if a bit late: Welcome! I suggest that: 1) You take the introductory Tour 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – gwr Mar 9 '18 at 14:46

Here is a simple example of how you might do it using RegionFunction. As proxy for a 3D-Plot I am using the binormal density from another post:

dist = BinormalDistribution[ {0, 0}, {1, 1}, 0.7 ] (* may sound familiar :) *)

  Plot3D[ PDF[dist, {x, y}], {x, -2, 2}, {y, -2, 2},
      RegionFunction -> Function[{x, y}, (x + y > 1) || (x + y < -1)],
      PlotRange -> All
  Plot3D[  PDF[dist, {x, y}], {x, -2, 2}, {y, -2, 2}, 
      RegionFunction -> Function[{x, y}, x + y <= 1 && x + y >=  -1],
      PlotStyle -> Red

enter image description here

  • $\begingroup$ Note that for a good result I negated the exlusions for the primary plot. $\endgroup$ – gwr Mar 9 '18 at 11:33
  • $\begingroup$ How can I bring a part of my calculations here? Sorry, I'm a beginner :/ $\endgroup$ – Perfect Fluid Mar 9 '18 at 14:20

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