# How to programmatically set custom labels for char view axes in Python

**URL:** https://discourse.paraview.org/t/how-to-programmatically-set-custom-labels-for-char-view-axes-in-python/9326
**Category:** ParaView Support
**Tags:** python
**Created:** [April 1, 2022, 3:57pm UTC](https://discourse.paraview.org/t/how-to-programmatically-set-custom-labels-for-char-view-axes-in-python/9326 "2022-04-01T15:57:12Z")
**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 1, 2022, 3:57pm UTC](https://discourse.paraview.org/t/how-to-programmatically-set-custom-labels-for-char-view-axes-in-python/9326/1 "2022-04-01T15:57:12Z")

</div>

Hello,

I would expect the following code:

```auto
view = CreateXYPlotView()
view.BottomAxisRangeMinimum = -5
view.BottomAxisRangeMaximum = 5
view.BottomAxisUseCustomRange = 1
view.BottomAxisLabels = xrange(-5, 6)
view.BottomAxisUseCustomLabels = 1

```

to allow me to set the tick labels for the bottom axis in the created view, similarly to how the same approach is used e.g. to set the custom ticks in e.g. a scalar color bar.  
However this fails for me at the `BottomAxisLabels` assignment, with the following error:

```auto
Traceback (most recent call last):
  File "/home/oblomov/uni/ingv/paper/implicit-visc-bicgstab/./draw-velocity-profiles.py", line 26, in <module>
    view.BottomAxisLabels = xrange(-5, 6)
  File "/usr/lib/python3/dist-packages/paraview/servermanager.py", line 496, in __setattr__
    setter(self, value)
  File "/usr/lib/python3/dist-packages/paraview/servermanager.py", line 2612, in setProperty
    return self.SetPropertyWithName(propName, value)
  File "/usr/lib/python3/dist-packages/paraview/servermanager.py", line 355, in SetPropertyWithName
    prop.SetData(arg)
  File "/usr/lib/python3/dist-packages/paraview/servermanager.py", line 879, in SetData
    self.SMProperty.SetElement(idx, val)
TypeError: SetElement argument 2: 

```

What would be the correct way to set custom labels?

---

<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 1, 2022, 4:25pm UTC](https://discourse.paraview.org/t/how-to-programmatically-set-custom-labels-for-char-view-axes-in-python/9326/2 "2022-04-01T16:25:00Z")

</div>

OK, apparently labels must be set as _pairs of strings_, so if one just wants to set some specific values one needs to do something like:

```auto
l = [str(x) for x in xrange(-5, 6)]
view.BottomAxisLabels = [s for p in zip(l, l) for s in p]

```
