Next: 4.16 Character escape sequences Up: 4. General features Previous: 4.14 Specifying area fill Contents Index

# 4.15 Color palette tables

Several programs, such as those which read 2-D gridded data sets and create colored images or shaded reliefs, need to be told what colors to use and over what z-range each color applies. This is the purpose of the color palette table (cpt-file). These files may also be used by psxy and psxyz to plot color-filled symbols. The colors may be specified either in the RGB (red, green, blue) system or in the HSV system (hue, saturation, value), and the parameter COLOR_MODEL in the .gmtdefaults file must be set accordingly. Using the RGB system, the format of the cpt-file is:

z | R | G | B | z | R | G | B | [A]
... |  |  |  |  |  |  |  |
z | R | G | B | z | R | G | B | [A]

Thus, for each ``z-slice'', defined as the interval between two boundaries (e.g., z to z), the color can be constant (by letting R = R, G = G, and B = B) or a continuous, linear function of z. The optional flag A is used to indicate annotation of the colorscale when plotted using psscale. A may be L, U, or B to select annotation of the lower, upper, or both limits of the particular -slice. However, the standard -B option can be used by psscale to affect annotation and ticking of colorscales. The background color (for z-values z), foreground color (for z-values z), and not-a-number (NaN) color (for z-values = NaN) are all defined in the .gmtdefaults file, but can be overridden by the statements

B | R | G | B
F | R | G | B
N | R | G | B

which can be inserted into the beginning or end of the cpt-file. If you prefer the HSV system, set the .gmtdefaults parameter accordingly and replace red, green, blue with hue, saturation, value. Color palette tables that contain grayshades only may replace the r-g-b triplets with a single grayshade in the 0-255 range.

A few programs (i.e., those that plot polygons such as grdview, psscale, and psxy) can accept pattern fills instead of grayshades. You must give the pattern as in the previous section (no leading -G of course), and only the first (low ) is used (we cannot interpolate between patterns). Finally, some programs let you skip features whose -slice in the cptfile has grayshades set to -. As an example, consider

30 | p200/16 | 80 | - |  |  |  |  |
80 | - | 100 | - |  |  |  |  |
100 | 255 | 0 | 0 | 200 | 255 | 255 | 0 |

where slice is painted with pattern # 16 at 200 dpi, slice is skipped, while slice is painted in a range of red to yellow, depending on the actual value of .

Some programs like grdimage and grdview apply artificial illumination to achieve shaded relief maps. This is typically done by finding the directional gradient in the direction of the artificial light source and scaling the gradients to have approximately a normal distribution on the interval -1,+1. These intensities are used to add ``white'' or ``black'' to the color as defined by the z-values and the cpt-file. An intensity of zero leaves the color unchanged. Higher values will brighten the color, lower values will darken it, all without changing the original hue of the color (see Appendix I for more details). The illumination is decoupled from the data grd-file in that a separate grdfile holding intensities in the -1,+1 range must be provided. Such intensity files can be derived from the data grdfile using grdgradient and modified with grdhisteq, but could equally well be a separate data set. E.g., some side-scan sonar systems collect both bathymetry and backscatter intensities, and one may want to use the latter information to specify the illumination of the colors defined by the former. Similarly, one could portray magnetic anomalies superimposed on topography by using the former for colors and the latter for shading.

Next: 4.16 Character escape sequences Up: 4. General features Previous: 4.14 Specifying area fill Contents Index