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

I’m trying to make a two color categorical CPT using makecpt, 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.

$ gmt makecpt -Cberlin -T-1/1/2 -F+cNegative,Positive
-1	24.5/12/9.5	B	;Negative
N	white
$ 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
$ 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
$ 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)?

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

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

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.

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.

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.

Hmm, doesn’t the white triangle indicate a soft hinge? Copied from


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…

And -T-1,1 should work too

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

Yes. I will fix that too.

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.

Cool, the original problem with the unintuitive makecpt -T-1/3/2 should be fixed (soon) in, and the colormap hinge problem is fixed already in! Thanks for the quick work!