Surface visualizations in the DLMF represent functions of the form $z=f(x,y)$ by the height $z$ or the magnitude, $|z|$, for complex functions, over the $x\times y$ plane. We use color to augment these vizualizations, either to reinforce the recognition of the height, or to convey an extra dimension to represent the phase of complex valued functions.

## Height Mapping

To provide an easily interpreted encoding of surface heights, a rainbow-like mapping of height to color is used. The following figure illustrates the piece-wise linear mapping of the height to each of the color components red, green and blue, written as $\left\langle R,\;G,\;B\right\rangle$.

Mathematically, we scale the height to $h$ lying in the interval $[0,4]$ and the components are computed as follows

 $\left\langle R,\;G,\;B\right\rangle=\begin{cases}\left\langle 0,\;h,\;1\right% \rangle&\text{if 0\leq h<1}\\ \left\langle 0,\;1,\;2-h\right\rangle&\text{if 1\leq h<2}\\ \left\langle h-2,\;1,\;0\right\rangle&\text{if 2\leq h<3}\\ \left\langle 1,\;4-h,\;0\right\rangle&\text{if 3\leq h\leq 4}\end{cases}$

## Phase Mappings

By painting the surfaces with a color that encodes the phase, $\operatorname{ph}f$, both the magnitude and phase of complex valued functions can be displayed. We offer two options for encoding the phase.

### Four Color Phase Mapping

The four color scheme quickly indicates in which quadrant $z$ lies: the colors blue, green, red and yellow are used to indicate the first, second, third and fourth quadrants, respectively. As a mnemonic, the colors are sorted alphabetically.

### Continuous Phase Mapping

For the continuous phase mapping, we map the phase continuously onto the hue, as both are periodic. In doing this, however, we would like to place the mathematically significant phase values, specifically the multiples of $\pi/2$ correponding to the real and imaginary axes, at more immediately recognizable colors.

The conventional CMYK color wheel (not to be confused with the traditional Artist’s color wheel) places the additive colors (red, green, blue) and the subtractive colors (yellow, cyan, magenta) at multiples of 60 degrees. In particular, the colors at 90 and 180 degrees are some vague greenish and purplish hues.

We therefore use a piecewise linear mapping as illustrated below, that takes phase $0$ to red, $\pi/2$ to yellow, $\pi$ to cyan and $3\pi/2$ to blue.

Specifically, by scaling the phase angle in $[0,2\pi)$ to $q$ in the interval $[0,4)$, the hue (in degrees) is computed as
 $\mathrm{hue}=60\begin{cases}q&\mbox{if 0\leq q<1}\\ 2q-1&\mbox{if 1\leq q<2}\\ q+1&\mbox{if 2\leq q<3}\\ 2(q-1)&\mbox{if 3\leq q<4}\end{cases}$