Next: Character escape sequences Up: General features Previous: Specifying area fill attributes

# 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:

z0 | Rmin | Gmin | Bmin | z1 | Rmax | Gmax | Bmax | [ A]
... |  |  |  |  |  |  |  |
zn-2 | Rmin | Gmin | Bmin | zn-1 | Rmax | Gmax | Bmax | [ A]

Thus, for each ``z-slice'', defined as the interval between two boundaries (e.g., z0 to z1), the color can be constant (by letting Rmin= Rmax, Gmin = Gmax, and Bmin = Bmax) or a continuous, linear function of z. The optional flag A is used to indicate anotation of the colorscale when plotted using psscale . A may be L, U, or B to select anotation of the lower, upper, or both limits of the particular z-slice. However, the standard -B option can be used by psscale to affect anotation and ticking of colorscales. The background color (for z-values < z0), foreground color (for z-values > zn-1), 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 | Rback | Gback | Bback
F | Rfore | Gfore | Bfore
N | Rnan | Gnan | Bnan

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.

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: Character escape sequences Up: General features Previous: Specifying area fill attributes