[vtkusers] vtkScalarbarWidget

Eric E. Monson emonson at cs.duke.edu
Thu Sep 16 09:38:43 EDT 2010


Hey Rakesh,

Here's an example (Python) of how I set up the vtkScalarBarWidget. I did the sizing by setting the "position coordinates" (relative to window size) on the representation:

vertexScalarBar = vtk.vtkScalarBarWidget()
vertexScalarBar.SetInteractor(iren)
vertexScalarBar.SetDefaultRenderer(view.GetRenderer())
vertexScalarBar.SetCurrentRenderer(view.GetRenderer())
vertexScalarBar.SetEnabled(True)
sbActor = vertexScalarBar.GetScalarBarActor()
sbActor.SetLookupTable(vertMapper.GetLookupTable())
sbActor.SetTitle(vertMapper.GetArrayName())
sbActor.SetNumberOfLabels(3)
scalarBarRep = vertexScalarBar.GetRepresentation()
scalarBarRep.SetOrientation(1)  # 0 = Horizontal, 1 = Vertical
scalarBarRep.GetPositionCoordinate().SetValue(0.05,0.05)
scalarBarRep.GetPosition2Coordinate().SetValue(0.15,0.25)

-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Sep 15, 2010, at 1:20 PM, Rakesh Patil wrote:

> Hello,
> 
> How can i set the height and width of the scalar bar actor in vtkScalarBarWidget??
> 
> I tried using scalarWidget->GetScalarBarActor()->SetHeight(0.85);
> 
> but i can't see any effect by doing so...
> 
> Is there any other way to set a particular height and width?
> 
> Thanks
> 
> Regards
> Rakesh Patil
> 
> 
> Dear VTK Mailing List ! Get Yourself a cool, short @in.com Email ID now!
> Report spam
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100916/f9fecf0b/attachment.htm>


More information about the vtkusers mailing list