# Distributed colour palette with white centred on 0

**URL:** <https://forum.generic-mapping-tools.org/t/distributed-colour-palette-with-white-centred-on-0/1774>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [June 10, 2021, 4:11pm UTC](https://forum.generic-mapping-tools.org/t/distributed-colour-palette-with-white-centred-on-0/1774 "2021-06-10T16:11:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shevelp](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/shevelp/32/1337_2.png) [@shevelp](https://forum.generic-mapping-tools.org/u/shevelp)\
**Post date:** [June 10, 2021, 4:11pm UTC](https://forum.generic-mapping-tools.org/t/distributed-colour-palette-with-white-centred-on-0/1774/1 "2021-06-10T16:11:19Z")

</div>

Hello!

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

# 

#----------------------------------------------------------

# COLOUR\_MODEL = RGB

# SOFT\_HINGE

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

---

<div class="post-metadata">

**Author:** ![maxrjones](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/maxrjones/32/2698_2.png) [@maxrjones](https://forum.generic-mapping-tools.org/u/maxrjones)\
**Post date:** [June 10, 2021, 6:02pm UTC](https://forum.generic-mapping-tools.org/t/distributed-colour-palette-with-white-centred-on-0/1774/2 "2021-06-10T18:02:08Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![shevelp](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/shevelp/32/1337_2.png) [@shevelp](https://forum.generic-mapping-tools.org/u/shevelp)\
**Post date:** [June 12, 2021, 11:33am UTC](https://forum.generic-mapping-tools.org/t/distributed-colour-palette-with-white-centred-on-0/1774/3 "2021-06-12T11:33:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![maxrjones](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/maxrjones/32/2698_2.png) [@maxrjones](https://forum.generic-mapping-tools.org/u/maxrjones)\
**Post date:** [June 12, 2021, 5:24pm UTC](https://forum.generic-mapping-tools.org/t/distributed-colour-palette-with-white-centred-on-0/1774/4 "2021-06-12T17:24:59Z")

</div>

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