# why are my negative contours not generating with vtk.vtkContourFilter?

**URL:** https://discourse.vtk.org/t/why-are-my-negative-contours-not-generating-with-vtk-vtkcontourfilter/10525
**Category:** Support
**Tags:** python
**Created:** [January 23, 2023, 4:12pm UTC](https://discourse.vtk.org/t/why-are-my-negative-contours-not-generating-with-vtk-vtkcontourfilter/10525 "2023-01-23T16:12:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Derek\_Eden](https://discourse.vtk.org/user_avatar/discourse.vtk.org/derek_eden/32/6458_2.png) [@Derek\_Eden](https://discourse.vtk.org/u/Derek_Eden)
#### Post date: [January 23, 2023, 4:12pm UTC](https://discourse.vtk.org/t/why-are-my-negative-contours-not-generating-with-vtk-vtkcontourfilter/10525/1 "2023-01-23T16:12:31Z")

</div>

I am using vtk.vtkContourFilter to create isolines from a dataset.

Everything seems to work fine, but any contour values I specify \<= 0 don’t seem to generate, even though there is definitely data with those values.

I am trying to contour this scalar ‘S’ in my unstructured grid file. I can see in paraview there are definitely values below 0, and can create the contours in paraview fine.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/5/50ef32370654d3d95a1c4b6ff725b6ba9ab82fa7.png)

This is my code to create the contours:

```auto
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName('file.vtk')
reader.Update()
out = reader.GetOutput()
out.GetPointData().SetActiveScalars('S')
cnt = vtk.vtkContourFilter()
cnt.SetInputData(out)
cnt.GenerateValues(9,-4,4)
cnt.SetOutputPointsPrecision(1) #my lines are very janky if I use 0 or 2
cnt.Update()
lines=cnt.GetOutput()
writer = vtk.vtkPolyDataWriter()
writer.SetInputData(lines)
writer.SetFileName('wow.vtk')
writer.Write()

```

When I visualize the output, there’s nothing above 0 for whatever reason. I’ve tried using SetNumberOfContours and setting values manually too, same result.

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

How can I make the filter contour the negative scalar values properly?

I feel like I am missing something basic.
