Appendix D. Palettes and false-color plots


Gnuplot provides a facility to map numeric values into a continuous range of colors. This allows you to create false-color plots (or heatmaps): graphs in which a numeric value is represented by a color, instead of by position.

In this appendix, we’ll first study how to set up such mappings between numbers and colors. Because the values in a false-color plot typically form a continuum, the mapping usually consists of a continuous color ramp or color gradient. The gnuplot command to create and manage such color gradients is set palette, and hence I’ll refer to these mappings as palettes. After introducing the commands to define palettes, we’ll look in detail at a catalog of example palettes for a variety of different applications and point out their strengths and weaknesses.

Next, we’ll study ways to use palettes to create colored graphs in gnuplot. Gnuplot’s palette feature is quite flexible, and you can use it for a variety of purposes, of which heatmaps are only one (but arguably the most important) example.

D.1. Warm-up examples

Before discussing all the various commands and options in detail, let’s quickly look at an example that demonstrates the capabilities that’ll be introduced in this appendix. Consider again the function that was studied in appendix C. There, you saw surface plots (such as figure C.1) and contour plots (figure C.8) of this function. Now we’re going to add some color!

D.2. Creating palettes

D.3. The colorbox

D.4. Using palettes

D.5. False-color plots

D.6. Case study: coloring the Mandelbrot set

D.7. Case study: an interactive palette explorer

D.8. Further reading