# How can I show constraints on parameters in 3D plot? [closed]

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.

• 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.
– Johu
Mar 9, 2018 at 10:58
• Use the option RegionFunction for Plot3D as shown in the documentation.
– gwr
Mar 9, 2018 at 11:07
• 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.
– gwr
Mar 9, 2018 at 14:46

## 1 Answer

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 :) *)

Show@{
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
]
}


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