-2

enter image description here

I have a graph that looks like this. It's a histogram and the x-axis is in a decreasing order.

Ben Yan
  • 9
  • 2

1 Answers1

1

Try using invert_axis()

import matplotlib.pyplot as plt
import numpy as np

data = np.random.randn(1000)  

plt.hist(data, bins=20, density=True)
plt.gca().invert_xaxis()
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.title('Descending Histogram')
plt.show()

output

sjri
  • 93
  • 5