# Two color cpt at -1 and +1 with no centre value

**URL:** <https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025>\
**Category:** Q&A\
**Created:** [November 11, 2020, 5:12am UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025 "2020-11-11T05:12:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [November 11, 2020, 5:12am UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/1 "2020-11-11T05:12:28Z")

</div>

I’m trying to make a two color categorical CPT using [`makecpt`](https://docs.generic-mapping-tools.org/dev/makecpt.html#t), with values at exactly -1 and +1, but can’t seem to get it right. This is with GMT version [`6.2.0_92c5676_2020.11.10`](https://github.com/conda-forge/gmt-feedstock/pull/110).

```bash
$ gmt makecpt -Cberlin -T-1/1/2 -F+cNegative,Positive
-1	24.5/12/9.5	B	;Negative
N	white

```

```bash
$ gmt makecpt -Cberlin -T-1/1/1 -F+cNegative,Positive
-1	40.25/104.25/134.5	L	;Negative
0	123.5/50.5/28.5	B	;Positive
N	white

```

```bash
$ gmt makecpt -Cberlin -T-1/1/0.5 -F+cNegative,Positive
-1	81.375/159.12/211.25	L	;Negative
-0.5	20/48.75/62.75	L	;Positive
0	63.75/18/1	L	
0.5	188.25/109.25/97.25	B	
N	white

```

```bash
$ gmt makecpt -Cberlin -T-1/2/1 -F+cNegative,Positive
-1	61/143/186.5	L	;Negative
0	24.5/12/9.5	L	;Positive
1	167/89.5/73	B	
N	white

```

### Desired output

How to create a CPT with just two colors (e.g. red and blue) and no centre value (0)?

```bash
-1	40.25/104.25/134.5	L	;Negative
1	123.5/50.5/28.5	B	;Positive
N	white

```

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [November 11, 2020, 5:32am UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/2 "2020-11-11T05:32:48Z")

</div>

Probably not obvious, but

```
gmt makecpt -Cberlin -T-1/3/2 -F+cNegative,Positive

-1 40.25/104.25/134.5 L ;Negative
1 123.5/50.5/28.5 B ;Positive
N white
```

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [November 11, 2020, 9:27am UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/3 "2020-11-11T09:27:28Z")

</div>

Ah right, just needed one more to get to 3! Thanks!

While we’re on the CPT theme, how does the soft hinge work? I’m getting a warning when trying to set it.

```bash
gmt makecpt -Cberlin+h3 -T-1/7/2
makecpt [WARNING]: gmt_stretch_cpt: CPT says it has a hinge but none is actually found? - ignored.
-1	81.375/159.12/211.25	1	81.375/159.12/211.25	L	
1	20/48.75/62.75	3	20/48.75/62.75	L	
3	63.75/18/1	5	63.75/18/1	L	
5	188.25/109.25/97.25	7	188.25/109.25/97.25	B	
B	158/176/255
F	255/173/173
N	white

```

Using `+h1`, `+h0` or `+h3` gives me the same result, but that doesn’t seem right.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [November 11, 2020, 8:23pm UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/4 "2020-11-11T20:23:30Z")

</div>

If the CPT has a soft hinge you can turn it into a hard hinge via +h. The list of CPTs in the docs indicates which ones has soft hinges - berlin does not.

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [November 11, 2020, 8:36pm UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/5 "2020-11-11T20:36:42Z")

</div>

Hmm, doesn’t the white triangle indicate a soft hinge? Copied from [https://docs.generic-mapping-tools.org/dev/cookbook/cpts.html#id3:](https://docs.generic-mapping-tools.org/dev/cookbook/cpts.html#id3:)

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/5f67d6f9b0979c35c0360b9612e2cc4e988c0745.png)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [November 11, 2020, 8:43pm UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/6 "2020-11-11T20:43:55Z")

</div>

I will look at the hinge message - perhaps not checking correctly.  
BTW, the original issues with -T will be fixed - I am declaring that a bug; should not have to say -T-1/3/2 to get -1, +1…

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [November 11, 2020, 9:16pm UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/7 "2020-11-11T21:16:47Z")

</div>

And **-T-1,1** should work too

```auto
gmt makecpt -Cberlin -T-1,1 -F+c
-1 24.5/12/9.5 B
B 158/176/255
F 255/173/173
N white

```

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [November 11, 2020, 9:27pm UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/8 "2020-11-11T21:27:53Z")

</div>

Yes. I will fix that too.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [November 11, 2020, 11:10pm UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/9 "2020-11-11T23:10:15Z")

</div>

Problem with the hinge is that a z = 0.0 entry is missing in several of the SCM CPTs. I need to add the same processing I do for oleron.

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [November 13, 2020, 2:10am UTC](https://forum.generic-mapping-tools.org/t/two-color-cpt-at-1-and-1-with-no-centre-value/1025/10 "2020-11-13T02:10:01Z")

</div>

Cool, the original problem with the unintuitive `makecpt -T-1/3/2` should be fixed (soon) in [https://github.com/GenericMappingTools/gmt/pull/4446](https://github.com/GenericMappingTools/gmt/pull/4446), and the colormap hinge problem is fixed already in [https://github.com/GenericMappingTools/gmt/pull/4447](https://github.com/GenericMappingTools/gmt/pull/4447)! Thanks for the quick work!
