title: How to generate a word frequency histogram, where bars are ordered according to their height
body: <p>I have a long list of words, and I want to generate a histogram of the frequency of each word in my list. I was able to do that in the code below:</p>
  
  <pre><code>import csv
  from collections import Counter
  import numpy as np
  
  word_list = ['A','A','B','B','A','C','C','C','C']
  
  counts = Counter(merged)
  
  labels, values = zip(*counts.items())
  
  indexes = np.arange(len(labels))
  
  plt.bar(indexes, values)
  plt.show()
  </code></pre>
  
  <p>It doesn't, however, display the bins by rank (i.e. by frequency, so highest frequency is first bin on the left and so on), even though when I print <code>counts</code> it orders them for me <code>Counter({'C': 4, 'A': 3, 'B': 2})</code>. How could I achieve that?</p>