Distributed colour palette with white centred on 0


I am writing because I am trying to generate a colour palette for my maps with the 0 with a certain colour. I explain my case:

I have a series of data in 3 columns (lat long & data). In order to automate the process I have saved the maximum($max_val) and minimum($min_val) value of the data column and used them to create my cpt with

gmt makecpt -Cpolar_pallete.cpt > colour.cpt

The structure of the file polar_pallete.cpt is as follows:

Simulates the POLAR




min_val blue 0 white
0 white max_val red

The result is as desired since white is 0, blue negatives and red positives. However, the scale used is a continuous scale and I need a discontinuous one.

Any advice? Thank you in advance!

You can use the -T option in makecpt to make a discrete colormap. Here is an example with a hinge at 0:

gmt makecpt -Cpolar+h0 -T-2000/600/200 > colors.cpt
gmt colorbar -Ccolors.cpt -Dx8c/1c+w12c/0.5c+jTC+h -png test

Hello, thank you very much for your reply. When I try to replicate what you say I get the following error:

makecpt [ERROR]: File /usr/share/gmt/cpt/polar+h0.cpt not found

It seems that it does not recognize the +h0 command, which is the one that in principle centers the target on the 0 from what you have said. Why can this be?

What version of GMT are you using? The -h feature was released in GMT 6.1.0.