Skip to main content

graphics - Getting rid of discontinuities in plots caused by square roots, logarithms, `Arg`, etc


I encounter this very often, here is just one recent example: I want


StreamPlot[ReIm[Sqrt[x+I y]],{x,-3,3},{y,-3,3},StreamStyle->"Line"]

and because of square root ambiguity get this unpleasant slit on the left:


enter image description here


Doing this with arrows reveals the reason -


enter image description here


Having seen this I managed to figure out how to fill the gap,


StreamPlot[{Sign[y]Sqrt[(Sqrt[x^2+y^2]+x)/2],Sqrt[(Sqrt[x^2+y^2]-x)/2]},{x,-3,3},{y,-3,3}]


gives what I want, namely


enter image description here


However this is clearly ad hoc and clumsy, and also there are more complicated cases where I don't know how to proceed, like e. g. those ugly white crosses in


ContourPlot[Arg[JacobiCN[x+I y,1/2]],{x,-5,5},{y,-5,5},ColorFunction->Hue]

enter image description here


Is there some uniform remedy for such cases?




Comments