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

**URL:** https://discourse.paraview.org/t/controlling-the-position-of-the-scalarbar-color-bar-in-python-scripting/9341
**Category:** Tips and Tricks
**Tags:** python
**Created:** [April 3, 2022, 10:55pm UTC](https://discourse.paraview.org/t/controlling-the-position-of-the-scalarbar-color-bar-in-python-scripting/9341 "2022-04-03T22:55:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Oblomov](https://discourse.paraview.org/user_avatar/discourse.paraview.org/oblomov/32/288_2.png) [@Oblomov](https://discourse.paraview.org/u/Oblomov)
#### Post date: [April 3, 2022, 10:55pm UTC](https://discourse.paraview.org/t/controlling-the-position-of-the-scalarbar-color-bar-in-python-scripting/9341/1 "2022-04-03T22:55:18Z")

</div>

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`:

```python
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:

```python
cb.WindowLocation = 'Any location'

```

I’m not sure if this is related to [this issue](https://gitlab.kitware.com/paraview/paraview/-/issues/19299) 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 😉

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 4, 2022, 7:34am UTC](https://discourse.paraview.org/t/controlling-the-position-of-the-scalarbar-color-bar-in-python-scripting/9341/2 "2022-04-04T07:34:22Z")

</div>

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](https://docs.paraview.org/en/latest/ClassroomTutorials/pythonAndBatchParaViewAndPython.html?highlight=trace#trace-recorder)
