# Coloring a vtkUnstructuredGrid by vector magnitude

**URL:** https://discourse.vtk.org/t/coloring-a-vtkunstructuredgrid-by-vector-magnitude/8840
**Category:** Support
**Created:** [July 1, 2022, 2:34am UTC](https://discourse.vtk.org/t/coloring-a-vtkunstructuredgrid-by-vector-magnitude/8840 "2022-07-01T02:34:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hye00525](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hye00525/32/4904_2.png) [@hye00525](https://discourse.vtk.org/u/hye00525)
#### Post date: [July 1, 2022, 2:34am UTC](https://discourse.vtk.org/t/coloring-a-vtkunstructuredgrid-by-vector-magnitude/8840/1 "2022-07-01T02:34:33Z")

</div>

hello, i’m trying to Coloring a vtkUnstructuredGrid by vector magnitude

The value I want to use for coloring is “VECTORS solution double” value in the file below.  
I want to color my vtkUnstructuredGrid using its magnitude.  
[beam\_test.vtk](https://discourse.vtk.org/uploads/short-url/zZZ5vcv2GvARiFfiuW76x5fZbws.vtk) (573.5 KB)

If I look at paraview, it looks like this:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/8/8b01cc0de00472e7ada3e46416a7baf35c9e3aaf.png)

I’m going to implement this using vtk.  
I found a helpful [link](https://vtkusers.public.kitware.narkive.com/yYMRhDDJ/colormap-unstructured-grid-by-vector-magnitude), but I couldn’t understand it because there was no example code.  
Is there a detailed example code?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [July 1, 2022, 7:53am UTC](https://discourse.vtk.org/t/coloring-a-vtkunstructuredgrid-by-vector-magnitude/8840/2 "2022-07-01T07:53:21Z")

</div>

Hi @hye00525

Here is a VTK example for this usecase: [https://kitware.github.io/vtk-examples/site/Cxx/Graphs/ColorVerticesLookupTable/](https://kitware.github.io/vtk-examples/site/Cxx/Graphs/ColorVerticesLookupTable/)
