# Set offset of text\_auto in barplots

**URL:** https://community.plotly.com/t/set-offset-of-text-auto-in-barplots/80741
**Category:** 📊 Plotly Python
**Tags:** question
**Created:** [December 7, 2023, 9:24am UTC](https://community.plotly.com/t/set-offset-of-text-auto-in-barplots/80741 "2023-12-07T09:24:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Madrigallo](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Madrigallo](https://community.plotly.com/u/Madrigallo)
#### Post date: [December 7, 2023, 9:24am UTC](https://community.plotly.com/t/set-offset-of-text-auto-in-barplots/80741/1 "2023-12-07T09:24:57Z")

</div>

How to shift the text\_auto labels of barplots, so that they don’t collide with error bars? Either to side or up or down.

```auto
import plotly.express as px
px.bar((1,2,3,), text_auto=".4s", error_y=[0.2, 0.2, 0.2])

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/4/5/455a10aa6761afa110d8e1777bccf5bd2c805097.png)

---

<div class="post-metadata">

### Author: ![farispriadi](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/farispriadi/32/26759_2.png) [@farispriadi](https://community.plotly.com/u/farispriadi)
#### Post date: [December 12, 2023, 12:03am UTC](https://community.plotly.com/t/set-offset-of-text-auto-in-barplots/80741/2 "2023-12-12T00:03:45Z")

</div>

Hi @Madrigallo ,

as far as I know if you use `text_auto`, it will be very limited to customize that.

And if you care about another ideas of customizing text label’s position inside the bar plot, this is what I thought.  
Instead using `text_auto`, it will be more flexible to shift the text to right side of error bar using `text`.  
By adding right amount of space before the text using `&nbsp;` html entity on each element of text in the list.  
You can do loops inside list using list comprehension.

```auto
import plotly.express as px
y = (1,2,3)
# fig= px.bar(y, text_auto=".4f", error_y=[0.2, 0.2, 0.2])
fig= px.bar(y, text=[('&nbsp;'*12)+f'{label:.4f}' for label in y], error_y=[0.2, 0.2, 0.2])
fig.show()

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/0/8/08c780efaf4cad0c08c7d0d83552206d6ae8a640.png)

The second alternative is using text annotations.

> **[Text](https://plotly.com/python/text-and-annotations/)**
>
> Over 17 examples of Text and Annotations including changing color, size, log axes, and more in Python.

Hope this reply help you find solution.
