# How to remove artefacts in Plot3D?

Consider the following code

Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1}]


Is it possible to remove the "dragging" artefacts observed at the boundaries x = 0 and y = 0? Naturally, the function is not defined here, but I am wondering whether I can get a cleaner plot. Is it possible to generally fix discontinuities in Plot3D? I am using version 14.0.0.

Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1},
Exclusions -> "Singularities"]


To "close" the exclusions:

Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1},
Exclusions -> "Discontinuities"]


• Lovely answer. Thanks! On a side note, why does Mathematica do that? Why does it attempt to plot at singularities by default, ending up with partially incomplete bands? Just curious about what Plot3D is actually attempting there. Commented Feb 27 at 15:22
• Thanks for the accept, Sam. Probably only the developers know why they chose this strange zigzag as standard.
– eldo
Commented Feb 27 at 16:40

One possible way

Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1},
PlotPoints -> 50, MaxRecursion -> 4]


You can play more with the values of PlotPoints and MaxRecursion if needed.

Note, PlotPoints seems to not be needed to change after adding MaxRecursion. Only MaxRecursion -> 4 is enough. So this is enough:

Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1},
MaxRecursion -> 4]

• Do you need PlotPoints? Commented Feb 19 at 16:02
• @samwolfe No, it is not needed. I was just trying different options. Will remove it. Commented Feb 19 at 16:02

You can state the exclusions manually too:

Plot3D[ArcTan[x/y] + ArcTan[y/x], {x, -1, 1}, {y, -1, 1},
Exclusions -> {x == 0, y == 0}]