0

Using the following code, I have created a plot of the frequency (y-axis) of a column of class labels in my dataframe.

fig, ax = plt.subplots(figsize=(15,10))
df.Dur_class.value_counts().plot(kind='bar')
ax.tick_params(axis='x', colors='white')
ax.tick_params(axis='y', colors='white')
plt.show()

enter image description here

I want to reorder the x-axis so that is increases numerically, i.e. 15, 30, 45, not 555, 540, 570...

thepez87
  • 221
  • 2
  • 12
  • Yo will then need to sort your data w.r.t X-values and then plot . [Here](df_c = df_c.sort_values('Count')), [here](https://stackoverflow.com/questions/44885933/how-to-sort-bars-in-a-bar-plot-in-ascending-order), [here](https://stackoverflow.com/questions/40902958/pandas-dataframe-bar-plot-with-sort-values-by-other-column), [here](https://stackoverflow.com/questions/22635110/sorting-the-order-of-bars-in-pandas-matplotlib-bar-plots) are some ways on how to sort and plot – Sheldore Nov 04 '18 at 12:31
  • To be able to give you an explicit answer, we need a sufficiently complete example to be able to work with it. (please see https://stackoverflow.com/help/mcve). – DrM Nov 04 '18 at 12:50

0 Answers0