# How to apply preset color map to vtkColorTransferFunction?

**URL:** https://discourse.vtk.org/t/how-to-apply-preset-color-map-to-vtkcolortransferfunction/8166
**Category:** Support
**Created:** [March 29, 2022, 9:47am UTC](https://discourse.vtk.org/t/how-to-apply-preset-color-map-to-vtkcolortransferfunction/8166 "2022-03-29T09:47:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![eino](https://discourse.vtk.org/user_avatar/discourse.vtk.org/eino/32/4537_2.png) [@eino](https://discourse.vtk.org/u/eino)
#### Post date: [March 29, 2022, 9:47am UTC](https://discourse.vtk.org/t/how-to-apply-preset-color-map-to-vtkcolortransferfunction/8166/1 "2022-03-29T09:47:03Z")

</div>

Hi,

I need to color a PolyData points/cells by a value in its fields.

This works well, but how can I use a preset color maps (e.g. “Cool to Warm”) for coloring?  
In vtk.js one can do

```auto
      const preset = vtkColorMaps.getPresetByName("Cool to Warm");
      transferFunction.applyColorMap(preset);

```

How can I do the same with VTK? I see the presets exist in vtkm’s ColorTable.h, but there’s no ApplyColorMap to use it in `vtkColorTransferFunction`. Do the value points need to be copied by hand, or is there a shortcut method to use the `ColorTable`?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [March 30, 2022, 9:05pm UTC](https://discourse.vtk.org/t/how-to-apply-preset-color-map-to-vtkcolortransferfunction/8166/2 "2022-03-30T21:05:36Z")

</div>

Hi, Eino,

As far as I know, that is a higher level functionality added to `vtk.js`. I don’t think the VTK base library has something like this and you probably have to write code to make a preset collection of color tables like this user here: [Display data with a "preset" LookupTable](https://discourse.vtk.org/t/display-data-with-a-preset-lookuptable/7139) . Maybe you can copy the part of Paraview code ([GitHub - Kitware/ParaView: VTK-based Data Analysis and Visualization Application](https://github.com/Kitware/ParaView)) that implements it.

regards,

Paulo

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [March 30, 2022, 10:13pm UTC](https://discourse.vtk.org/t/how-to-apply-preset-color-map-to-vtkcolortransferfunction/8166/3 "2022-03-30T22:13:30Z")

</div>

My comments here may be useful: [Thermograph color map](https://discourse.vtk.org/t/thermograph-color-map/8160)

---

<div class="post-metadata">

### Author: ![eino](https://discourse.vtk.org/user_avatar/discourse.vtk.org/eino/32/4537_2.png) [@eino](https://discourse.vtk.org/u/eino)
#### Post date: [March 31, 2022, 9:53am UTC](https://discourse.vtk.org/t/how-to-apply-preset-color-map-to-vtkcolortransferfunction/8166/4 "2022-03-31T09:53:21Z")

</div>

Thank you for your answers. Indeed seems I will need to implement it by hand
