[Paraview] How Create Scalar Bar from Python?

Kent Eschenberg eschenbe at psc.edu
Fri Mar 28 15:02:56 EDT 2008


Kent Eschenberg wrote:
> Using pvpython 3.2.1 on Linux. Making a "representation" of a colormap 
> just crashes though that seems the most logical way. I cannot find 
> anything that looks like the C++ class vtkScalarBarActor. Help!

In the example program, below, the sphere appears with the expected colormap but the colormap legend does not. Am I creating the legend B the right way? How should I connect B to V?

Can anyone suggest how to do this?

TIA!
Kent
Pittsburgh Supercomputing Center

===
from paraview import servermanager
servermanager.Connect()
V = servermanager.CreateRenderView()

C = servermanager.rendering.PVLookupTable()
C.ColorSpace = 1
C.RGBPoints = ( 0,1,0,0, 1,1,1,0 )

S = servermanager.sources.SphereSource()

SR = servermanager.CreateRepresentation( S, V )
SR.LookupTable = C
SR.ColorAttributeType = 0
SR.ColorArrayName = "Normals"

B = servermanager.vtkSMScalarBarActorProxy()
B.LookupTable = C
B.Position = [0.5, 0.2]

V.StillRender()
V.ResetCamera()
V.StillRender()

raw_input("Exit: ")


More information about the ParaView mailing list