8
$\begingroup$

I had a more general question about a similar problem more than two years ago, Getting rid of discontinuities in plots caused by square roots, logarithms, `Arg`, etc, which got lots of interesting feedback but no definite answer.

So I decided to focus on something more obviously urgent and simple.

Here is the result of

ContourPlot[Log[Abs[Sinh[Sinh[x+I y]]]],{x,-4,4},{y,-4,4},
 MeshFunctions->{Arg[Sinh[Sinh[#1+I #2]]]&},
 Mesh->11,PlotPoints->150,Contours->50]

enter image description here

I guess I don't even need to ask: I want to get rid of those rough thick black lines, that's all.

PS Heard rumours that it might be incorporated in version 12. I have 11.0.1.0, but still, let me know if this is the case.

$\endgroup$
1
  • 1
    $\begingroup$ Generally, MeshFunctions should be continuous. Discontinuities lead to such ugly streaks. $\endgroup$
    – Michael E2
    Feb 2, 2021 at 19:06

1 Answer 1

11
$\begingroup$

The problem is the discontinuity in Arg. One way to correct it is to apply a continuous periodic function (of period $2\pi$) to it. I used TriangleWave so that the differences between mesh lines would remain the same.

ContourPlot[Log[Abs[Sinh[Sinh[x + I y]]]],
 {x, -4, 4}, {y, -4, 4},
 MeshFunctions -> {TriangleWave[
     Arg[Sinh[Sinh[#1 + I #2]]]/(2 Pi) - 1/24] &}, 
 Mesh -> {1/6 + Range[-3, 2]/3},
 PlotPoints -> 201, Contours -> 50]

Alternative

This takes a bit longer for a high-quality plot, but it shows the Arg[] nicely. A bit hard to figure out how to scale the ColorFunction, too.

ComplexPlot[Sinh[Sinh[z]], {z, -4 - 4 I, 4 + 4 I},
 PlotPoints -> 801, Mesh -> {51, 1/6 + Range[-3, 2]/3}, 
 MeshFunctions -> {Log@Abs[#2] &, 
   TriangleWave[Arg[#2]/(2 Pi) - 1/24] &},
 MeshStyle -> Directive[Thin, GrayLevel[0.]],
 ColorFunction -> {(Evaluate@
      ColorData["M10DefaultDensityGradient"][
       0.5 + Clip[Log[#7] - 6, {-15, 15}]/30] &), "CyclicArg"}, 
 ColorFunctionScaling -> False, RasterSize -> 1000]
$\endgroup$
2
  • $\begingroup$ Very clean solution, thanks! One correction though: I think you mean a continuous periodic function, since Arg itself is in fact periodic. $\endgroup$ Feb 2, 2021 at 21:56
  • $\begingroup$ @მამუკაჯიბლაძე Right, it should be continuous. $\endgroup$
    – Michael E2
    Feb 2, 2021 at 21:57

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.