# trying to colour Point Gaussians in unstructured grid with scalars

**URL:** https://discourse.paraview.org/t/trying-to-colour-point-gaussians-in-unstructured-grid-with-scalars/6859
**Category:** ParaView Support
**Created:** [April 3, 2021, 11:11pm UTC](https://discourse.paraview.org/t/trying-to-colour-point-gaussians-in-unstructured-grid-with-scalars/6859 "2021-04-03T23:11:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bitminer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bitminer/32/5903_2.png) [@bitminer](https://discourse.paraview.org/u/bitminer)
#### Post date: [April 3, 2021, 11:11pm UTC](https://discourse.paraview.org/t/trying-to-colour-point-gaussians-in-unstructured-grid-with-scalars/6859/1 "2021-04-03T23:11:03Z")

</div>

I have some points and attributes (scalar, vector) originally in hdf5, and convert to a VTU file with python. I can define Point Gaussians at the points but they are always gray.I cannot seem to get a scalar attribute to colour them.

Here, without the hdf5, is example code, using pvpython (Paraview 5.9.0):

```
import vtk

x = [[0, 0, 0], [1, 0, 0], [2, 0, 0], [0, 1, 0],
    [1, 1, 0], [2, 1, 0], [0, 0, 1], [1, 0, 1],
    [2, 0, 1], [0, 1, 1], [1, 1, 1], [2, 1, 1],
    [0, 1, 2], [1, 1, 2], [2, 1, 2], [0, 1, 3],
    [1, 1, 3], [2, 1, 3], [0, 1, 4], [1, 1, 4],
    [2, 1, 4], [0, 1, 5], [1, 1, 5], [2, 1, 5],
    [0, 1, 6], [1, 1, 6], [2, 1, 6]]

points = vtk.vtkPoints()
for i in range(0, len(x)):
    points.InsertPoint(i, x[i])

ugrid = vtk.vtkUnstructuredGrid()
ugrid.SetPoints(points)
wf = vtk.vtkXMLUnstructuredGridWriter()
wf.SetFileName('simple1.vtu')
wf.SetInputDataObject(ugrid)
wf.Write()

vt = vtk.vtkFloatArray()

for i in range(0,len(x)):
    vt.InsertValue(i,x[i][2]/6.0)

vt.SetName('x')

fd=vtk.vtkFieldData()
fd.AddArray(vt)

ugrid.SetFieldData(fd)

wf.SetFileName('simple2ad.vtu')
wf.Write()

```

I open the simpl2ad.vtu file, the Information tab shows x as range [0,1] and the Bounds as expected.

Set Properties to Outline, Coloring to Solid Color, and I see the enclosing box.

Set representation to Point Gaussian, coloring to “x”, see gray balls.

As an experiment (one of many) I add a PythonCalculator with expression (inputs[0].FieldData[‘x’]) association Point Data, representation Point Gaussian, Coloring to “result”, and see gray balls. (I can print that expression and see the x values in Output Messages tab).

Both with and without PythonCalculator it shows a color legend but nothing seems to change the colours.

Any hints what might be wrong?

John

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 6, 2021, 8:25am UTC](https://discourse.paraview.org/t/trying-to-colour-point-gaussians-in-unstructured-grid-with-scalars/6859/2 "2021-04-06T08:25:11Z")

</div>

please share the vtu file.

---

<div class="post-metadata">

### Author: ![bitminer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bitminer/32/5903_2.png) [@bitminer](https://discourse.paraview.org/u/bitminer)
#### Post date: [April 6, 2021, 3:26pm UTC](https://discourse.paraview.org/t/trying-to-colour-point-gaussians-in-unstructured-grid-with-scalars/6859/3 "2021-04-06T15:26:02Z")

</div>

Here it is…[simple2ad.vtu](https://discourse.paraview.org/uploads/short-url/3retfNqQJwhrVhRUTsENjM5bRM1.vtu) (1.9 KB)
