Hello all.<div><br></div><div>I&#39;m writing a bit of custom Python with Qt and VTK to add some visualization to a small PyQt GUI we have.</div><div><br></div><div>I need to read ExodusII and just do some simple contour plotting of what&#39;s in there with a color scale/legend (I also draw the edges so you can see the mesh).  I have it basically working at this point (although hardcoded to a specific variable name... but I&#39;ll change that later). But I&#39;m hung up at trying to change the colors of the contours.</div>
<div><br></div><div>All I want is very simple.  Right now it generates from Red to Blue (low to high)... all I need is for it to go from Blue to Red (BTW - why the heck is Red to Blue the default... shouldn&#39;t Blue to Red be the default?  I think most people associate Red with a high color... especially if you are plotting temperature... but that&#39;s beside the point).</div>
<div><br></div><div>I&#39;ve looked at vtkLookupTable and vtkColorTransferFunction... but I can&#39;t seem to come up with the right magic.  Basically, what I want is just the simple Blue to Red HSV color bar that you can get in Paraview by choosing that preset.  Any help would be awesome!</div>
<div><br></div><div>Here is my current code (it&#39;s in a Python class that inherits from QWidget and uses a QVTKWidget2 that is initialized elsewhere):</div><div><br></div><div><br></div><div><div><br></div><div><div>    self.file_name = file_name</div>
<div>    reader = vtk.vtkExodusIIReader()</div><div>    reader.SetFileName(self.file_name)</div><div>    reader.UpdateInformation()</div><div>    reader.SetAllArrayStatus(vtk.vtkExodusIIReader.NODAL, 1)</div><div>    reader.SetAllArrayStatus(vtk.vtkExodusIIReader.NODAL_TEMPORAL, 1)</div>
<div>    reader.SetTimeStep(1)</div><div>    reader.Update()</div><div><br></div><div>    cdp = vtk.vtkCompositeDataPipeline()</div><div>    vtk.vtkAlgorithm.SetDefaultExecutivePrototype(cdp)</div><div><br></div><div>    geom = vtk.vtkCompositeDataGeometryFilter()</div>
<div>    geom.SetInputConnection(0,reader.GetOutputPort(0));</div><div>    geom.Update()</div><div><br></div><div>    data = geom.GetOutput()</div><div>    data.GetPointData().SetScalars(data.GetPointData().GetArray(&quot;u&quot;))</div>
<div>    mapper = vtk.vtkPolyDataMapper()</div><div>    mapper.SetInput(data)</div><div>    mapper.ScalarVisibilityOn()</div><div>    mapper.SetColorModeToMapScalars()</div><div>    mapper.SetColorMode(2)</div><div>    mapper.SetScalarRange(0,1.0)</div>
<div><br></div><div>    actor = vtk.vtkActor()</div><div>    actor.SetMapper(mapper)</div><div>    self.renderer.AddActor(actor)</div><div><br></div><div>    edge_geom = vtk.vtkCompositeDataGeometryFilter()</div><div>    edge_geom.SetInputConnection(0,reader.GetOutputPort(0));</div>
<div>    edge_geom.Update()</div><div><br></div><div>    edges = vtk.vtkExtractEdges()</div><div>    edges.SetInput(edge_geom.GetOutput())</div><div>    edge_mapper = vtk.vtkPolyDataMapper()</div><div>    edge_mapper.SetInput(edges.GetOutput())</div>
<div><br></div><div>    edge_actor = vtk.vtkActor()</div><div>    edge_actor.SetMapper(edge_mapper)</div><div>    edge_actor.GetProperty().SetColor(0,0,0)</div><div><br></div><div>    self.renderer.AddActor(edge_actor)</div>
<div><br></div><div>    scalar_bar = vtk.vtkScalarBarActor()</div><div>    scalar_bar.SetLookupTable(mapper.GetLookupTable())</div><div>    scalar_bar.SetTitle(&quot;u&quot;)</div><div>    scalar_bar.SetNumberOfLabels(4)</div>
<div><br></div><div>    self.renderer.AddActor2D(scalar_bar)</div><div><br></div><div>    # Avoid z-buffer fighting</div><div>    vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset()</div><div><br></div><div>
<br></div><div>    self.renderer.ResetCamera()</div><div>    self.vtkwidget.updateGL()</div></div></div><div><br></div>