# How to change the color of the Point Cloud Data?

**URL:** https://discourse.vtk.org/t/how-to-change-the-color-of-the-point-cloud-data/942
**Category:** Support
**Created:** [May 10, 2019, 3:59am UTC](https://discourse.vtk.org/t/how-to-change-the-color-of-the-point-cloud-data/942 "2019-05-10T03:59:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [May 10, 2019, 3:59am UTC](https://discourse.vtk.org/t/how-to-change-the-color-of-the-point-cloud-data/942/1 "2019-05-10T03:59:49Z")

</div>

Hi all.

This is my 2nd question about VTK! 🙂

Last time, I have inquired on loading the PLY file.  
link: [The PLY file is not working.](https://discourse.vtk.org/t/the-ply-file-is-not-working/924)

I can change the color of Point Cloud Data by applying the parameter of Color Map Editor on ParaView program.

So, I want to it also works on my code.

I have tested the sample code(below links), but I couldn’t apply color.  
link1: [Filled contours / discrete number of colors](https://discourse.vtk.org/t/filled-contours-discrete-number-of-colors/537)  
link2: [https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/ColorCells/](https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/ColorCells/)  
link3:

The my test code is as below:

```
vtkSmartPointer<vtkPLYReader> pPLYReader =
	vtkSmartPointer<vtkPLYReader>::New();
pPLYReader->SetFileName("myPLY.ply");
pPLYReader->Update();

vtkSmartPointer<vtkPointGaussianMapper> mapper =
	vtkSmartPointer<vtkPointGaussianMapper>::New();

mapper->SetInputConnection(pPLYReader->GetOutputPort());
mapper->SetScaleFactor(0);
mapper->ScalarVisibilityOn();
mapper->SetScalarRange(0, 1500);
mapper->SetScalarModeToUsePointFieldData();
mapper->ColorByArrayComponent("VelocityMagnitude", 0);

vtkSmartPointer<vtkActor> actor =
	vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);

vtkSmartPointer<vtkRenderer> renderer =
	vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
renderer->SetBackground(.1, .2, .3);
renderer->ResetCamera();

m_vtkWindow->AddRenderer(renderer);
m_vtkWindow->Render();

```

Could you please asvise me what is the problem?

Thank you.

Best regards,  
William Kim

---

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [May 15, 2019, 11:53pm UTC](https://discourse.vtk.org/t/how-to-change-the-color-of-the-point-cloud-data/942/2 "2019-05-15T23:53:38Z")

</div>

Finally, I can change the color of Point Cloud Data.

The ‘ScalarBarActorColor’ sample code will be helpful.  
[https://lorensen.github.io/VTKExamples/site/Java/Visualization/ScalarBarActorColorSeries/](https://lorensen.github.io/VTKExamples/site/Java/Visualization/ScalarBarActorColorSeries/)
