Repository navigation
Closed
Labels
feature requestNew feature wanted
Description
This issue serves as the central place for discussing and tracking the implementation of the pygmt.makecpt function in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.
Documentation
- GMT: https://docs.generic-mapping-tools.org/dev/makecpt.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/makecpt
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.makecpt.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
-
-A[+a] (transparency): Set a constant level of transparency (0–100) for all color slices; append +a to also affect foreground, background, and NaN colors. -
-C(cmap): Select the master CPT to use in the interpolation; supports all built-in GMT color tables. -
-D[i|o] (background): Match the background and foreground colors to the colors for the lowest and highest z-values in the output CPT. -
-E[nlevels]: Create a CPT from the data range of the input table by dividing into nlevels equidistant levels; requires a data table as standard input. -
-F[R|r|h|c][+c[label|start[-]]] (color_model): Force output CPT to be written with a specific color model (RGB, HSV, CMYK); optionally append +c for categorical formatting. -
-Gzlo/zhi (truncate): Truncate the incoming CPT so that the lowest and highest z-levels are zlo and zhi. -
-H(output): Write the CPT to standard output (i.e., to a named file set byoutput). -
-I[c|z] (reverse): Reverse the sense of color progression, or reverse the z-values. -
-M(overrule_bg): Overrule background, foreground, and NaN colors from the master CPT with the GMT configuration parameters. -
-N(no_bg): Do not write out the background, foreground, and NaN-color fields. -
-Q:log -
-S -
-T[min/max/inc[+b|l|n]|file|list] (series): Define the range of the new CPT. -
-V:verbose -
-W(categorical): Do not interpolate; pick output colors from the beginning of the master CPT. -
-Ww(cyclic): Produce a wrapped (cyclic) color table that endlessly repeats its range. -
-Z:continuous -
: Use--PAR=valuepygmt.configinstead. -
-bi -
-di -
-ho -
-i
Notes on Input Formats
makecptdoes not take a data table as input in the standard case; it reads and interpolates an existing master CPT.- The
-Eoption (not yet implemented) would require a data table as input to determine the data range automatically. - By default, the generated CPT is saved as the current CPT of the session/figure/subplot/panel/inset hierarchy. Use
outputto write to a named.cptfile. - The
categoricalandcyclicparameters are mutually exclusive; passing both raisesGMTParameterError.
Linked Pull Requests
- Initial feature implementation – Wrap makecpt #329
- Add
categoricalandcyclicparameters – Migrate test_figure_shift_origin to dvc #1133 - Add
output(-H) parameter to save CPT to file – Add static_earth_relief to grd2xyz tests #1737 - Add
transparency(-A) parameter – Add a package-level variable __gmt_version__ for development use #2362 - Implement
-Eoption for building CPT from a data table's actual range - Add a gallery or tutorial example specifically demonstrating
makecptwith user-defined data ranges and custom color models
Related Issues and Discussions
pygmt.makecptis called before any plot using a colorbar; the resulting CPT is automatically used byFigure.colorbar.- The
seriesparameter accepts the output frompygmt.info'snearest_multipleoption directly, enabling a seamless range-to-colormap workflow. - The
truncateandreverse="z"parameters interact: reversal is applied before truncation, soseriesmust match the reversed z-range.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity