Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

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

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

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:

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
)