# Issue creating CPT

**URL:** <https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890>\
**Category:** Q&A\
**Created:** [April 26, 2023, 8:35pm UTC](https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890 "2023-04-26T20:35:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [April 26, 2023, 8:35pm UTC](https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890/1 "2023-04-26T20:35:18Z")

</div>

I’m having an issue creating a cpt.

Steps:

Create a simple text file with colors (as hex).  
I want constant color for each slice, so Color\_min = Color\_max (ref. [3.20.2. Regular CPTs](https://docs.generic-mapping-tools.org/dev/cookbook/features.html#regular-cpts)):

```auto
# colors manually read off the map
# https://www.gebco.net/news_and_media/ibcao_printable_map.html
cat<<eof > temp-ibcao.cpt
-6000 #2E5085 -5000 #2E5085
-5000 #3563A0 -4000 #3563A0
-4000 #3C77BC -3000 #3C77BC
-3000 #4897D3 -2000 #4897D3
-2000 #5AB9E9 -1000 #5AB9E9
-1000 #5CC3EB -500 #5CC3EB
-500 #78CEF0 -200 #78CEF0
-200 #94DAF5 -100 #94DAF5
-100 #B0E6FA -50 #B0E6FA
-50 #CDF2FF 0 #CDF2FF
0 #C3D150 50 #C3D150
50 #E2E166 100 #E2E166
100 #DFC45C 200 #DFC45C
200 #D3B251 300 #D3B251
300 #BD962F 400 #BD962F
400 #A37F2F 500 #A37F2F
500 #99762B 600 #99762B
600 #8F6E27 700 #8F6E27
700 #876824 800 #876824
800 #75581D 1000 #75581D
1000 #75581D 1001 #FFFFFF
eof

```

Use `makecpt -Ctemp-ibcao.cpt` to make a _proper_ cpt, with fore-, back- and NaN-colors:

```auto
# use makecpt to make proper cpt
$ gmt makecpt -Ctemp-ibcao.cpt 
-6000	46/80/133	-5000	46/80/133	
-5000	53/99/160	-4000	53/99/160	
-4000	60/119/188	-3000	60/119/188	
-3000	72/151/211	-2000	72/151/211	
-2000	90/185/233	-1000	90/185/233	
-1000	92/195/235	-500	92/195/14	B <-- color_max != color_min
-500	120/206/240	-200	120/206/240	
-200	148/218/245	-100	148/218/245	
-100	176/230/250	-50	176/230/250	
-50	205/242/255	0	205/242/255	
0	195/209/80	50	195/209/80	
50	226/225/102	100	226/225/102	
100	223/196/92	200	223/196/92	
200	211/178/81	300	211/178/81	
300	189/150/47	400	189/150/47	
400	163/127/47	500	163/127/47	
500	153/118/43	600	153/118/2	B <-- color_max != color_min 
600	143/110/39	700	143/110/39	
700	135/104/36	800	135/104/36	
800	117/88/29	1000	117/88/29	
1000	117/88/29	1001	white	
B	black
F	white
N	128

```

Everything looks as expected, except the color slices -1000 to -500 and 500 to 600. In these slices the Color\_max is changed. In addition, these two slices get a **B** (the optional flag to _indicate annotation of both limits of the particular z-slice of the color scale when plotted using colorbar_, again ref. [3.20.2. Regular CPTs](https://docs.generic-mapping-tools.org/dev/cookbook/features.html#regular-cpts)).

Why is this? Feature of bug? From testing, it seems like the default is that all slices get the **L** flag, except the last one, which gets a **B** flag. I cannot find much information about this in the docs.

If I manually add **L** to the two problem-slices, it works as expected:

```auto
cat<<eof > temp-ibcao.cpt
-6000 #2E5085 -5000 #2E5085
-5000 #3563A0 -4000 #3563A0
-4000 #3C77BC -3000 #3C77BC
-3000 #4897D3 -2000 #4897D3
-2000 #5AB9E9 -1000 #5AB9E9
-1000 #5CC3EB -500 #5CC3EB L
-500 #78CEF0 -200 #78CEF0
-200 #94DAF5 -100 #94DAF5
-100 #B0E6FA -50 #B0E6FA
-50 #CDF2FF 0 #CDF2FF
0 #C3D150 50 #C3D150
50 #E2E166 100 #E2E166
100 #DFC45C 200 #DFC45C
200 #D3B251 300 #D3B251
300 #BD962F 400 #BD962F
400 #A37F2F 500 #A37F2F
500 #99762B 600 #99762B L
600 #8F6E27 700 #8F6E27
700 #876824 800 #876824
800 #75581D 1000 #75581D
1000 #75581D 1001 #FFFFFF
eof

```

```auto
$ gmt makecpt -Ctemp-ibcao.cpt 
-6000	46/80/133	-5000	46/80/133	
-5000	53/99/160	-4000	53/99/160	
-4000	60/119/188	-3000	60/119/188	
-3000	72/151/211	-2000	72/151/211	
-2000	90/185/233	-1000	90/185/233	
-1000	92/195/235	-500	92/195/235	L <-- correct, color_max = color_min
-500	120/206/240	-200	120/206/240	
-200	148/218/245	-100	148/218/245	
-100	176/230/250	-50	176/230/250	
-50	205/242/255	0	205/242/255	
0	195/209/80	50	195/209/80	
50	226/225/102	100	226/225/102	
100	223/196/92	200	223/196/92	
200	211/178/81	300	211/178/81	
300	189/150/47	400	189/150/47	
400	163/127/47	500	163/127/47	
500	153/118/43	600	153/118/43	L <-- correct, color_max = color_min
600	143/110/39	700	143/110/39	
700	135/104/36	800	135/104/36	
800	117/88/29	1000	117/88/29	
1000	117/88/29	1001	white	
B	black
F	white
N	128

```

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [April 27, 2023, 12:45am UTC](https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890/2 "2023-04-27T00:45:36Z")

</div>

> [@Andreas](#):
>
> From testing, it seems like the default is that all slices get the **L** flag, except the last one, which gets a **B** flag. I cannot find much information about this in the docs.

I remember having a similar issue. Have You look in the forum?

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [April 27, 2023, 6:51am UTC](https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890/3 "2023-04-27T06:51:24Z")

</div>

Probably not enough. I’ll do some searching. Thanks Esteban.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [April 27, 2023, 7:48am UTC](https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890/4 "2023-04-27T07:48:36Z")

</div>

Here’s your post @Esteban82; [Purpose of column LB in CPTs](https://flint.soest.hawaii.edu/t/purpose-of-column-lb-in-cpts/1373/1).

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [April 27, 2023, 9:20am UTC](https://forum.generic-mapping-tools.org/t/issue-creating-cpt/3890/5 "2023-04-27T09:20:15Z")

</div>

Fixed. See [#7423](https://github.com/GenericMappingTools/gmt/pull/7423).
