✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

How to plot Horizontal Bar using values.index?

How can I achieve this in Plotly Express using Horizontal Bar?

The main problem is how to use counts in x-axis?

Hi @saurav
Have you tried looking at the bar graph documentation and building the plot from one of the examples there?

Yes, I have tried. I want to plot count on x-axis how to do that?

This should work:

fig = px.bar(data_canada, x='state', y='count')


It doesn’t.

Here is my dataset:


I want to plot state on y-axis and corresponding values of states as count in x-axis