Let $z \in \mathbb C$ be an arbitrary complex number. Call it
- Red, if $\Im(z^7) > 0$
- Blue, if $\Im(z^7) < 0$
- Gray, if $\Im(z^7) = 0$.
I want to make a plot in which the red, blue and gray regions of the complex plane are painted in the appropriate color. I have the following helper function:
proc[f_, r_] := ComplexContourPlot[f, {z, 2},
Contours -> r, ContourShading -> {LightBlue, LightPink}];
The naïve way to use this function is
proc[Im[z^7], {0}]
This does not work as nicely as one would hope. The plot is distorted near the origin due to numerical stability issues in the calculation of $\Im(z^7)$ for very small $z$.
Another attempt would be
r = Range[-Pi, Pi, Pi/7];
proc[Arg[z], r]
This almost works, but not quite. The negative real axis is not painted correctly. This behavior is not unexpected, because Arg[z]
is discontinuous at the negative real axis. But it is still annoying.
One rather ugly way to make this work is
p1 = proc[Arg[z], r];
p2 = proc[Arg[-z], {0}];
Show[p2, p1]
Is there anything less egregious than this that will still work?
PlotPoints
not an option? I don't have MM 12, so I can't useComplexContourPlot
, but usingContourPlot[Im[(x + I y)^7], {x, -2, 2}, {y, -2, 2}, PlotPoints -> 100]
in MM 11 seems to give a reasonable result. $\endgroup$ContourPlot[Im[(x + I y)^7], {x, -2, 2}, {y, -2, 2}, ColorFunction -> (Blend[{Blue, Gray, Red}, LogisticSigmoid[10 #]] &), ColorFunctionScaling -> False, PlotPoints -> 100, PlotRange -> All]
$\endgroup$