[Paraview] How Create Scalar Bar from Python?

Sylvester Gerardson sylvester.gerardson at gmail.com
Mon Mar 31 03:07:34 EDT 2008


Kent,

If I remember correctly, I did something like:

sBar1 =
servermanager.rendering.ScalarBarWidgetRepresentation(registrationGroup='sca
lar_bars', registrationName="ScalarBarWidgetRepresentation1")
sBar1.Title = 'Normals'
sBar1.LookupTable = C
V.SR.append(sBar01)

Good luck!

Regards,
Sylvester 

> -----Original Message-----
> From: paraview-bounces at paraview.org 
> [mailto:paraview-bounces at paraview.org] On Behalf Of Kent Eschenberg
> Sent: Friday, March 28, 2008 8:03 PM
> To: ParaView
> Subject: Re: [Paraview] How Create Scalar Bar from Python?
> 
> 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: ")
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list