Plotly reading numbers instead of text

My values are:

x = [32, 13, 24, 7, 9]
y = [β€˜0’, β€˜1’, β€˜2 to 5’, β€˜6 to 10’, β€˜>10’]

It looks like plotly things that my y values are numbers and plots the 2 first values of my list (0 and 1).

My chart then shows as y ticks: -0.5, 0, 0.5, 1, 1.5 instead of β€˜0’, β€˜1’, β€˜2 to 5’, β€˜6 to 10’, β€˜>10’.

How do I do to tell plotly that my y values are strings and not numbers ?

Thanks for your help.
C

@christianv You can do this by using the layout.yaxis.type attribute. Setting it to 'categorical' should do the trick.

Thank you very much Michael for your help. How should I write this into the following code ?

data = [go.Bar(x=x, y=y, text=x, textposition = β€˜auto’, orientation=β€˜h’, marker=dict(color=colors))]
layout = go.Layout(margin=go.layout.Margin(l=530, r=50, b=90, t=90, pad=25), autosize=False, width=2000, height=1000, font=dict(size=45))
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename=β€˜horizontal-bar’)
pio.write_image(fig, Q2.jpg")

In advance, thank you for your help.
Best,
C

found it:

layout = go.Layout(margin=go.layout.Margin(l=200, r=50, b=90, t=90, pad=25), autosize=False, width=2000, height=800, font=dict(size=45), yaxis=dict(type=β€œcategory”))

thanks,
C