# how to color unstructured grid (.vtu) ?

**URL:** https://discourse.paraview.org/t/how-to-color-unstructured-grid-vtu/10140
**Category:** VR/AR
**Tags:** vtk
**Created:** [August 14, 2022, 4:55pm UTC](https://discourse.paraview.org/t/how-to-color-unstructured-grid-vtu/10140 "2022-08-14T16:55:48Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [August 15, 2022, 8:38am UTC](https://discourse.paraview.org/t/how-to-color-unstructured-grid-vtu/10140/2 "2022-08-15T08:38:38Z")

</div>

Hello,

I am not sure if this is a proper solution, but it might work if you create a new mapper at the end of the `setColors` function.

```auto
            output.GetPointData().SetScalars(colors);

+ vtkDataSetMapper mapper = vtkDataSetMapper.New();
+ mapper.SetInput(output);
+ actor.SetMapper(mapper);
        }

```

It may also be possible to draw the array directly instead of creating an RGB array. (The following was also added at the end of the `setColors` function.)

```auto
            #output.GetPointData().SetScalars(colors);

+ var mapper = actor.GetMapper();
+ mapper.SelectColorArray(column);
+ mapper.SetScalarModeToUsePointFieldData();
+ var range1 = getRange(actorIndex, column);
+ mapper.SetScalarRange(range1[0], range1[1]);
        }

```

I think your question will be better answered in the vtk forum ([https://discourse.vtk.org/](https://discourse.vtk.org/)) than in the ParaView forum.

---

_[View the full topic](https://discourse.paraview.org/t/how-to-color-unstructured-grid-vtu/10140)._
