Next: 4.16 Character escape sequences Up: 4.15 Color palette tables Previous: 4.15.1 Categorical CPT files Contents Index

## 4.15.2 Regular CPT files

Here, the colors may be specified either in the RGB- (red, green, blue), CMYK- (cyan, magenta, yellow, black), or in the HSV-system (hue, saturation, value, and here the comment # COLOR_MODEL = HSV must be present in the cpt file since there are no other way to distinguish between HSV and RGB). Color names can also be used. Using the RGB system4.12, the format of the cpt-file is:

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

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 color scale when plotted using psscale. The optional code 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 color scales. The optional semicolon followed by a text label will make psscale, when used with the -L option, place the supplied label instead of formatted z-values.

As for categorical tables, 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 .gmtdefaults4 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 .gmtdefaults4 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. For CMYK, give four values in the 0-100 range. Both the min and max color specifications in one z-slice must use the same color system, i.e., you cannot mix ``red'' and 0/255/100 on the same line.

A few programs (i.e., those that plot polygons such as grdview, psscale, and psxy) can accept pattern fills instead of grayshades. You must specify the pattern as in Section 4.14 (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 | 200 | 0 | 0 | 200 | 255 | 255 | 0 |
200 | yellow | 300 | green |  |  |  |  |

where slice is painted with pattern # 16 at 200 dpi, slice is skipped, slice is painted in a range of dark red to yellow, whereas the slice will linearly yield colors from yellow to green, 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 grid file in that a separate grid file holding intensities in the [-1,+1] range must be provided. Such intensity files can be derived from the data grid 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.15 Color palette tables Previous: 4.15.1 Categorical CPT files Contents Index