8
$\begingroup$

Consider the following code

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

enter image description here

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.

$\endgroup$

3 Answers 3

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

enter image description here

To "close" the exclusions:

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

enter image description here

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – sam wolfe
    Feb 27 at 15:22
  • $\begingroup$ Thanks for the accept, Sam. Probably only the developers know why they chose this strange zigzag as standard. $\endgroup$
    – eldo
    Feb 27 at 16:40
10
$\begingroup$

One possible way

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

Mathematica graphics

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]
$\endgroup$
2
  • $\begingroup$ Do you need PlotPoints? $\endgroup$
    – sam wolfe
    Feb 19 at 16:02
  • $\begingroup$ @samwolfe No, it is not needed. I was just trying different options. Will remove it. $\endgroup$
    – Nasser
    Feb 19 at 16:02
6
$\begingroup$

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}]

enter image description here

$\endgroup$

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.