I have a list {{x1, y1, z1}, {x2, y2, z2}, ... , {xN, yN, zN}}, which I am plotting using ListPlot3D. The {x, y} values are in three of the four quadrants, that is $x$ and $y$ cannot both be positive. In the plot, I want this region to just remain white. However, because there are data points in the quadrants to the left {x<0, y>0} and below {x>0, y<0} this quadrant {x>0, y>0}, Mathematica connects the two quadrants and eventually gives regions within this absent quadrant.

Mathematica seems to be interpolating across a region where I have no data points. How do I ensure that nothing is plotted in the quadrant where there are no data points?


1 Answer 1


Use RegionFunction to limit the region for plotting. For instance, for a start you could use RegionFunction -> Function[{x, y, z}, x < 0 || y < 0] to limit plotting to the region where x OR y are negative.

Here is some made up data for demonstration:

coords =
   Tuples[Range[-3, 3, 0.05], 2],
   Not[Positive[#1] && Positive[#2]] & @@ # &

list = {#1, #2, Sin[#1^2 - #2^2]} & @@@ coords;

The results with just ListPlot3D displays the "interpolation" you mentioned:

ListPlot3D[list, ViewPoint -> {0.2, -0.5, 3}]

there is data in the positive, positive quadrant

Instead, with RegionFunction, there is no data there:

  ViewPoint -> {0.2, -0.5, 3}, 
  RegionFunction -> Function[{x, y, z}, x < 0 || y < 0]

no data in the positive, positive quadrant


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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