# Implementing exclusions in ListPlot3D

How can I stop ListPlot3D from drawing segments between data points that differ by a certain threshold? In my example these far separated data points correspond to data samples either side of a discontinuity.

This question is a natural extension of the question here for ListPlot, and may well be a trivial extension for those who know what they're doing. Or perhaps not.

Here is an example:

r = x^2 + y^2;
data = Table[r Tan[r], {x, -2, 2, 0.01}, {y, -2, 2, 0.01}];
ListPlot3D[data, ClippingStyle -> None]


I appreciate that here we can split the plotting into two different regions before and after the discontinuity in Tan, but in the general case this is not so easy.

• I tag @corey979, the accepted answerer from the previous question, but with no implied obligation! – Tom Jan 17 '17 at 11:39

I suppose you could pick a plot range (perhaps from a test plot) and use RegionFunction to enforce it:
ListPlot3D[data, ClippingStyle -> None,

• I think this sort of tweaking of plots is for polishing presentations and papers, so using a test plot seems quite practical. However, a semi-automatic way to pick a range might be something like Quantile[Flatten@data, {0.05, 0.95}]. – Michael E2 Jan 17 '17 at 15:10