Plotly graph object misinterpreting strings and integers

Hi,

I currently noticed some strange behaviour with my plotly object when i was trying to plot some basic charts

please take a look at it and let me know of your comments

import plotly.graph_objects as go

fig=go.Figure(data=[go.Bar(x=[β€˜1’,β€˜2’,β€˜Three’],y=[β€˜23’,β€˜35’,β€˜40’])])
fig.show()

When i plot the figure i find just display for 1 and 2 and the string β€˜three’ is being left out.

Can someone explain to me what is going on. Plotly graph object is misunderstanding strings and str(int).

Hi @Jason4,

If you set the xaxis_type='category' you’ll get the right plot.:

fig=go.Figure(data=[go.Bar(x=['1','2','Three'],y=['23','35','40'])])
fig.update_layout(xaxis_type='category')
1 Like