makecpt man page

makecpt — Make GMT color palette tables


makecpt [ [+]transparency ] [ cpt ] [ [i|o] ] [ [nlevels] ] [ [R|r|h|c ] [ zlo/zhi ] [ ] [ ] [ ] [ [i|o] ] [ z_min/z_max[/z_inc[+]] | -Tztable ] [ [level] ] [ ] [ ]

Note: No space is allowed between the option flag and the associated arguments.


makecpt is a utility that will help you make color palette tables (CPT files). You define an equidistant set of contour intervals or pass your own z-table, and create a new CPT file based on an existing master CPT file. The resulting CPT file can be reversed relative to the master cpt, and can be made continuous or discrete. For color tables beyond the standard GMT offerings, visit cpt-city: http://soliton.vm.bytemark.co.uk/pub/cp….

The CPT file includes three additional colors beyond the range of z-values. These are the background color (B) assigned to values lower than the lowest z-value, the foreground color (F) assigned to values higher than the highest z-value, and the NaN color (N) painted wherever values are undefined.

If the master CPT file includes B, F, and N entries, these will be copied into the new master file. If not, the parameters COLOR_BACKGROUND, COLOR_FOREGROUND, and COLOR_NAN from the gmt.conf file or the command line will be used. This default behavior can be overruled using the options -D, -M or -N.

The color model (RGB, HSV or CMYK) of the palette created by makecpt will be the same as specified in the header of the master CPT file. When there is no COLOR_MODEL entry in the master CPT file, the COLOR_MODEL specified in the gmt.conf file or on the command line will be used.

Optional Arguments

Sets a constant level of transparency (0-100) for all color slices. Prepend + to also affect the fore-, back-, and nan-colors [Default is no transparency, i.e., 0 (opaque)].
Selects the master color table CPT file to use in the interpolation. Choose among the built-in tables (type makecpt to see the list) or give the name of an existing CPT file [Default gives a rainbow CPT file]. Yet another option is to specify -Ccolor1,color2[,color3,...] to build a linear continuous cpt from those colors automatically. In this case colorn can be a r/g/b triplet, a color name, or an HTML hexadecimal color (e.g. #aabbcc ).
Select the back- and foreground colors to match the colors for lowest and highest z-values in the output CPT file [Default uses the colors specified in the master file, or those defined by the parameters COLOR_BACKGROUND, COLOR_FOREGROUND, and COLOR_NAN]. Append i to match the colors for the lowest and highest values in the input (instead of the output) CPT file.
Implies reading data table(s) from given command-line files or standard input. We use the last data column to determine the data range; use -i to select another column, and use -bi if your data table is native binary. This z-range information is used instead of providing the -T option. We create a linear color table by dividing the table data z-range into nlevels equidistant slices. If nlevels is not given it defaults to the number of levels in the chosen CPT file.
Force output CPT file to written with r/g/b codes, gray-scale values or color name (R, default) or r/g/b codes only (r), or h-s-v codes (h), or c/m/y/k codes (c).
Truncate the incoming CPT so that the lowest and highest z-levels are to zlo and zhi. If one of these equal NaN then we leave that end of the CPT alone. The truncation takes place before any resampling.
Reverses the sense of color progression in the master CPT file. Also exchanges the foreground and background colors, including those specified by the parameters COLOR_BACKGROUND and COLOR_FOREGROUND.
Overrule background, foreground, and NaN colors specified in the master CPT file with the values of the parameters COLOR_BACKGROUND, COLOR_FOREGROUND, and COLOR_NAN specified in the gmt.conf file or on the command line. When combined with -D, only COLOR_NAN is considered.
Do not write out the background, foreground, and NaN-color fields [Default will write them].
Selects a logarithmic interpolation scheme [Default is linear]. -Qi expects input z-values to be log10(z), assigns colors, and writes out z [Default]. -Qo takes log10(z) first, assigns colors, and writes out z.
-Tz_min/z_max[/z_inc[+]] | -Tztable
Defines the range of the new CPT file by giving the lowest and highest z-value and interval. When used with -C and z_inc is not specified, the number of intervals remains the same as in the input palette. If z_inc is specified with a trailing + we interpret z_inc as the number of desired intervals instead. Alternatively, give the name of a ASCII file that has one z-value per record. If -T is not given, the existing range in the master CPT file will be used intact.
-V[level] (more ...)
Select verbosity level [c].
Do not interpolate the input color table but pick the output colors starting at the beginning of the color table, until colors for all intervals are assigned. This is particularly useful in combination with a categorical color table, like "categorical". Cannot be used in combination with -Z.
Creates a continuous CPT file [Default is discontinuous, i.e., constant colors for each interval].
-^ or just -
Print a short message about the syntax of the command, then exits (NOTE: on Windows use just -).
-+ or just +
Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exits.
-? or no arguments
Print a complete usage (help) message, including the explanation of options, then exits.
Print GMT version and exit.
Print full path to GMT share directory and exit.


To make a CPT file with z-values from -200 to 200, with discrete color changes every 25, and using a polar blue-white-red colortable:

gmt makecpt -Cpolar -T-200/200/25 > colors.cpt

To make an equidistant CPT file from z = -2 to 6, in steps of 1, using continuous default rainbow colors:

gmt makecpt -T-2/6/1 -Z > rainbow.cpt

To make a GEBCO look-alike CPT file for bathymetry, run

gmt makecpt -Cgebco > my_gebco.cpt

To create a 24-level rainbow color table suitable for plotting the depths in the data table depths.txt (with lon, lat, depths), run

gmt makecpt -Cgebco depths.txt -i2 -Z -E24 > my_depths.cpt


Since makecpt will also interpolate from any existing CPT file you may have in your directory, you cannot use one of the listed cpt names as an output filename; hence the my_gebco.cpt in the example.

See Also

gmt, grd2cpt

Referenced By

cptcat(1), cptclip(1).

Explore man page connections for makecpt(1).

GMT 5.2.1 November 12, 2015