# Makecpt with white background, white NaNs and foreground that matches high end

**URL:** <https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023>\
**Category:** Q&A\
**Created:** [June 15, 2022, 3:56pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023 "2022-06-15T15:56:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Geodesy](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/john_geodesy/32/116_2.png) [@John\_Geodesy](https://forum.generic-mapping-tools.org/u/John_Geodesy)\
**Post date:** [June 15, 2022, 3:56pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023/1 "2022-06-15T15:56:58Z")

</div>

Is there a reason why only the COLOR\_NAN can be reset when the -D and -M options are being used?

I want to have the values above the color bar range to match the top end of the color bar, but I want NaNs and values below the color bar to be set to white. Is there a way to do this on the command line?

For example (I know, this doesn’t do it, but I want it to):

```
gmt makecpt -Cjet -Z -D -T0.15/0.30/0.01 -M --COLOR_BACKGROUND=white --COLOR_NAN=white > t.cpt
```

---

<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:** [June 15, 2022, 5:51pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023/2 "2022-06-15T17:51:28Z")

</div>

Only way would be for us to add directives to **-M** so that it only applies to a subset of B, F, N. E.g.

**-M** [**b**][**f**][**n**] where **-M** (no args) would mean **-Mbfn** (affect all of them).

---

<div class="post-metadata">

**Author:** ![John\_Geodesy](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/john_geodesy/32/116_2.png) [@John\_Geodesy](https://forum.generic-mapping-tools.org/u/John_Geodesy)\
**Post date:** [June 15, 2022, 6:10pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023/3 "2022-06-15T18:10:51Z")

</div>

Woohoo, sounds like a great idea! Should I enter it into Git as a feature request?

---

<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:** [June 15, 2022, 6:24pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023/4 "2022-06-15T18:24:02Z")

</div>

Yes please. Will look at it after 6.4 is out the door in 1-2 days.

---

<div class="post-metadata">

**Author:** ![John\_Geodesy](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/john_geodesy/32/116_2.png) [@John\_Geodesy](https://forum.generic-mapping-tools.org/u/John_Geodesy)\
**Post date:** [June 15, 2022, 6:35pm UTC](https://forum.generic-mapping-tools.org/t/makecpt-with-white-background-white-nans-and-foreground-that-matches-high-end/3023/5 "2022-06-15T18:35:55Z")

</div>

No hurry on my end. This will be a useful tweak. I’ll enter a request on Git.
