# Phaseful plots

March 12, 2016

I've added a new color function to the cplot function in mpmath as well as the complex_plot example program in Arb. With the old scheme (which is still default), the phase is rendered as hue and the magnitude is rendered as brightness. With the new (optional) scheme, only the phase is rendered. Positive reals are white, negative reals are black, complex numbers in the upper half plane are orange/gold, and complex numbers in the lower half plane are blue.

Here is the Riemann zeta function on $[-20,20] + [-20,40]i$ with the new style (left) and the default style (right):

More simply, $\sin(z)$ on $[-5,5] + [-5,5]i$ with the new style (left) and the default style (right):

The Jacobi theta function $\theta_1(0.6+0.4i, \tau)$ on $[-2,2] + [0,1]i$ with the new style (top) and the default style (bottom):

Finally, new and default style plots of the error function and the gamma function on $[-5,5] + [-5,5]i$:

The new color scheme conveys less information than the default scheme, but sometimes leads to more aesthetically pleasing images. The black and white level curves (where the plotted function is purely real-valued) stand out clearly, and zeros/poles are easy to identify as the points where black and white meet.

For reference, the new color scheme consists of interpolating linearly between the following values:

 $\arg(z) / \pi$ R G B -1.0 0.0 0.0 0.0 -0.95 0.1 0.2 0.5 -0.5 0.0 0.5 1.0 -0.05 0.4 0.8 0.8 0.0 1.0 1.0 1.0 +0.05 1.0 0.9 0.3 +0.5 0.9 0.5 0.0 +0.95 0.7 0.1 0.0 +1.0 0.0 0.0 0.0

You could do the coloring in many other ways. The Wikipedia article on domain coloring contains some ideas and many nice links. In mpmath, the user can easily supply their own color function, but it would be nice to have a few more optional schemes built-in.