# Colormaps RGBPoints clarification

**URL:** https://discourse.vtk.org/t/colormaps-rgbpoints-clarification/7287
**Category:** Web
**Created:** [November 26, 2021, 4:14pm UTC](https://discourse.vtk.org/t/colormaps-rgbpoints-clarification/7287 "2021-11-26T16:14:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Alireza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alireza/32/6230_2.png) [@Alireza](https://discourse.vtk.org/u/Alireza)
#### Post date: [November 26, 2021, 4:14pm UTC](https://discourse.vtk.org/t/colormaps-rgbpoints-clarification/7287/1 "2021-11-26T16:14:56Z")

</div>

I am familiar with colorTransfer function and what the next two lines would do

```auto
const ctfun = vtkColorTransferFunction.newInstance();
ctfun.addRGBPoint(200.0, 1.0, 1.0, 1.0);

```

However, there are a number of colormaps here in [colorMaps.json](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/ColorTransferFunction/ColorMaps.json) that I would like to get more information about.

- What is the mapping between RGBPoints in to the colors?
- Is there a min and max for RGBPoints array? Why there is a `-1` (I thought it should be between `[0,1]`?
- What is `"NanColor"` in some of the colormaps

Thanks!

Here is the `jet` colormap as an example

```json
{
  "ColorSpace" : "RGB",
  "Name" : "jet",
  "RGBPoints" : [
      -1,
      0,
      0,
      0.5625,
      -0.777778,
      0,
      0,
      1,
      -0.269841,
      0,
      1,
      1,
      -0.015873,
      0.5,
      1,
      0.5,
      0.238095,
      1,
      1,
      0,
      0.746032,
      1,
      0,
      0,
      1,
      0.5,
      0,
      0
  ]
},

```

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [November 29, 2021, 7:42pm UTC](https://discourse.vtk.org/t/colormaps-rgbpoints-clarification/7287/2 "2021-11-29T19:42:20Z")

</div>

The RGBPoints array is a contiguous array of 4-tuples that match the signature of the `addRGBPoint` function: `[value1, red1, green1, blue1, value2, red2, green2, blue2, ...]`.

The negative values should make sense once you understand the array structure. So `[-1, 0, 0, 0.5625]` means map the value -1 to the rgb color `[0, 0, 0.5625]`.

NanColor tells the color transfer function to map NaN values to a particular color.

---

<div class="post-metadata">

### Author: ![Alireza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alireza/32/6230_2.png) [@Alireza](https://discourse.vtk.org/u/Alireza)
#### Post date: [November 29, 2021, 7:46pm UTC](https://discourse.vtk.org/t/colormaps-rgbpoints-clarification/7287/3 "2021-11-29T19:46:20Z")

</div>

Thanks, and does every other value get linearly interpolated between the min and max of the “values” portion of the array?

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [November 29, 2021, 7:55pm UTC](https://discourse.vtk.org/t/colormaps-rgbpoints-clarification/7287/4 "2021-11-29T19:55:42Z")

</div>

> Thanks, and does every other value get linearly interpolated between the min and max of the “values” portion of the array?

Yes, values are linearly interpolated.
