# Bar Chart

**URL:** <https://discuss.streamlit.io/t/bar-chart/30294>\
**Category:** Using Streamlit\
**Created:** [September 6, 2022, 8:06am UTC](https://discuss.streamlit.io/t/bar-chart/30294 "2022-09-06T08:06:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gegreg](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gegreg](https://discuss.streamlit.io/u/gegreg)\
**Post date:** [September 6, 2022, 8:06am UTC](https://discuss.streamlit.io/t/bar-chart/30294/1 "2022-09-06T08:06:42Z")

</div>

Hi everyone,

I am creating a bar chart with streamlit with x-axis [Jan, Feb, March].  
However, the x-axis is sorted automatically when the graph is plotted.[Feb, Jan, March]  
May I know if there any way to unsort?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![naomilago](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/naomilago/32/18090_2.png) [@naomilago](https://discuss.streamlit.io/u/naomilago)\
**Post date:** [September 6, 2022, 9:33am UTC](https://discuss.streamlit.io/t/bar-chart/30294/2 "2022-09-06T09:33:50Z")

</div>

Howdy, @gegreg!

If you’re using plotly, dealing with `categoryorder` might be a way. For that, you’ll need to call a method to update the layout as follows:

`fig.update_layout(xaxis={'categoryorder':'total descending'})`

PS.: You can switch between _total ascending_ and _total descending_

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [September 6, 2023, 9:34am UTC](https://discuss.streamlit.io/t/bar-chart/30294/3 "2023-09-06T09:34:20Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
