Personal tools
You are here: Home Data and Tools Color Tables

Color Tables

General Remarks

  • Point data values are always interpolated linearly between grid points.
  • Cell data values are not interpolated, but are constant over the whole grid cell. Thus, in order to visualize discrete values at grid points, it makes sense to convert the point data to cell data.

Free Color Tables

A large collection of color tables can be found here: CPT City. Another source is OpenClipArt, where color gradients are available - if every color appears just once, these gradients can be used for color tables.

File Formats and Tools

The following programs support color tables (see: http://soliton.vm.bytemark.co.uk/pub/cpt-city/notes/formats.html and http://soliton.vm.bytemark.co.uk/pub/cpt-city/notes/software.html):

  • GMT (*.cpt); contains the tool makecpt to create color tables.
  • Paraview (*.xml); contains a graphical editor for color tables.
  • Gnuplot
  • SVG vector graphics files can contain color gradient definitions
  • Inkscape, the leading SVG editor, contains a graphical editor for color gradients.
  • GIMP (*.ggr); contains a graphical editor for color gradients, and can load SVG gradients.
  • CSS3 contains also a specification of color gradients

... and many more, some can read the GMT format.

Most of these color tables use only the RGB color model, except GMT and GIMP, and not all programs support transparency.

The program collection cptutils can convert between some of these formats.

Paraview

XML Color Table Files

Here are some color tables for Paraview:

Color tables created with GMT (using makecpt) can be converted into the Paraview format using this tool: gmtcpt2paraview.pl

And here are the built-in color tables from GMT, converted using this script: gmt_colortables_for_paraview.zip

Integrated Color Tables in VTK Files

It is possible to include a color lookup table directly in a Paraview file if the file type is the legacy VTK format. Such a color table consists of a line with LOOKUP_TABLE, the name of the table, and the number of entries (see example). The following lines have four columns; the values are floating point numbers between 0 and 1. Their meaning: red value, green value, blue value, opacity.

The lookup table is mapped on data values between 0 and 1. So if you want to use a lookup table, you have to scale your data to the range 0–1. The entries of the lookup table are spread equally over this range; so if you have three entries, they will be mapped to the data values 0, 0.5 and 1. Data values smaller than 0.25 are displayed in the first color, values bigger than 0.75 are displayed in the third color, and the values in between in the second color.

To use the lookup table, just substitute LOOKUP_TABLE default by LOOKUP_TABLE name (with the name of your custom lookup table) in the data section of your VTK file.

LOOKUP_TABLE france 3
0.000000  0.000000  1.000000  1.000000
1.000000  1.000000  1.000000  1.000000
1.000000  0.000000  0.000000  1.000000

This defines a lookup table with three colors (blue, white and red); the values 0–0.33 are displayed in blue, 0.33–0.66 in white and 0.66–1 in red.

Caveats:

  • This type of lookup tables is only possible in the legacy VTK format.
  • Because these files are internally converted when loading them into a multi-process Paraview (i.e. when running Paraview with MPI) or when applying any filter, the colors are lost.
  • There is a workaround to avoid the default rainbow color scale. For example, if you have a map, you want to display the sea in bluish colors and the rest in shades of green or beige.
    • In this case, you can use the threshold filter to separate the dataset into two pieces, one with the land and one with the sea.
    • Then you change the name of the variable in one of the files; e.g. if the height data is stored in the variable altitude, rename it in the sea file to depth.
    • If you load both files, you can assign different color scales to them – e.g. dark blue to turquoise for the sea and green to brown for the land.
Document Actions