# Categories x axis and placing annotations at origin when categories are all numeric

**URL:** <https://community.plotly.com/t/categories-x-axis-and-placing-annotations-at-origin-when-categories-are-all-numeric/45616>\
**Category:** 📊 Plotly Python\
**Created:** [October 2, 2020, 6:25am UTC](https://community.plotly.com/t/categories-x-axis-and-placing-annotations-at-origin-when-categories-are-all-numeric/45616 "2020-10-02T06:25:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicky1](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nicky1/32/12321_2.png) [@nicky1](https://community.plotly.com/u/nicky1)\
**Post date:** [October 2, 2020, 6:25am UTC](https://community.plotly.com/t/categories-x-axis-and-placing-annotations-at-origin-when-categories-are-all-numeric/45616/1 "2020-10-02T06:25:30Z")

</div>

I’d like to add my annotation near the origin of the x axis rather than on the category that happens to be ‘0’ (a string).  
 ![Untitled](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/c/ccf27465a53405ded71c2f177414aa5f32699e30.png)

Plotly seems to interpret the values of x as integers despite type=‘category’.

Is there a way around that?

Here’s mmy add\_shape and add\_annotation function calls:

```auto
figure.update_xaxes(type='category', categoryorder='total descending')
figure.add_shape( # add a horizontal "avg" line
        type="line", line_color="#404040", line_width=3, opacity=1, line_dash="dot",
        x0=0, x1=1, xref="paper", y0=df[y_key].mean(), y1=df[y_key].mean(), yref="y"
)

figure.add_annotation( # add a text with arrow
        text="Avg ({} {})".format(int(round(df[y_key].mean())), f.get_unit_of(y_key)), x=0, y=df[y_key].mean(), arrowhead=1, showarrow=True
)

```
