Controlling the position of the ScalarBar / color bar in Python scripting

Hello,

I struggled quite a bit to find how to control the position of the color bar when rendering my results in a Python script, as the common suggestion found online to just set the Position property were not sufficient, e.g.with paraview.simple:

cb = GetScalarBar(lut, view)
cb.Position = [0.5, 0.5]

leaves the color bar at the default place on Render(). In fact, any assignment to the Position property seems to be ignored.

After a lot of looking around, I discovered that apparently it is also necessary to change another setting:

cb.WindowLocation = 'Any location'

I’m not sure if this is related to this issue or intentional behavior, but I’m guessing in the latter case it might be worth it to improve the documentation to this effect. Or refer users to this post :wink:

Good point, in any case, there is this more general tips that can be applied more generally when trying to find how to do something in pvpython

“Juste use the trace”

https://docs.paraview.org/en/latest/ClassroomTutorials/pythonAndBatchParaViewAndPython.html?highlight=trace#trace-recorder