# New color functions

April 6, 2018

Domain coloring plots of complex functions rendered with the complex_plot script in Arb are a recurrent feature on this blog. Domain coloring requires the choice of a color function that maps a complex number to an (R, G, B) tuple. Previously only two such functions were provided: -color 0 gives the standard "rainbow" map (mapping phase to hue and magnitude to brightness) and -color 1 renders the phase alone in orange and blue. Today, I decided to try to come up with a few more aesthetically pleasing color functions.

Through some experiments with blend modes in GIMP, I found that it is possible to get quite appealing results by evaluating both the -color 0 and -color 1 functions, merging them using a dodge filter with 50% opacity, and then changing the color balance. A "color balance" transformation in GIMP can be specified by a tuple of 9 parameters: the adjustment for shadows, midtones and highlights (defined using ramp functions) for the red, green and blue channels separately. After finding a few nice such parameter combinations, I looked up the exact formula for color balance used in GIMP and implemented it in complex_plot. These color balance parameters can now be selected with -color N, with N between 2 and 6. Even more color functions can naturally be added in the future.

Each of the new color functions is demonstrated below by plotting three favorite functions: the modular j-invariant, the gamma function, and the Riemann zeta function. Click the images for 1024px resolution, or fetch the git version of Arb and try the code on your own computer if you want higher resolution or a different function! I used the following invocations to create the pictures:

build/examples/complex_plot -color N -range 0 2 0 1 -size 2048 1024 modj
build/examples/complex_plot -color N -range -23 23 -23 23 -size 1024 1024 zeta
build/examples/complex_plot -color N -range -5 5 -5 5 -size 1024 1024 gamma

## N = 2

This is the result of the dodge operation alone; that is, the identity balance transformation (0, 0, 0, 0, 0, 0, 0, 0, 0) is used. The lack of reds make this scheme a bit easier on the eyes than the default (-color 0) rainbow map, but it's also a little dull.

## N = 3

This uses the color balance transformation (0, -0.5, 0.2, 0, 0, -0.1, 0, -1.0, -0.2). The result is a shiny, chrome-like look.

## N = 4

This is definitely my favorite! The colors are warm and the gradients are paint-like. The transformation is (0, -0.5, 0.2, 0, 0.5, -0.1, 0, -0.3, -1.0).

## N = 5

This has some of the same paint-like quality, but with cold colors. The transformation is (0, -0.5, -1.0, 0, -0.1, -0.67, 0, -0.55, -0.12).

## N = 6

I say tomato. Transformation (0.86, 0, 0.13, 0.57, 0.19, -0.52, 0.31, -0.30, -0.94).