title: Matplotlib - bar chart that shows frequency of unique values
body: <p>I have an array like:</p>
  
  <p>[1, 3, 5, 2, 12, 12, 3, 6,...] etc which varies between 1-12 that represents moths.</p>
  
  <p>Now, I can plot them with</p>
  
  <pre><code>plt.hist(months,range(1, 13))
  plt.title("Job Request per month")
  plt.xlabel("Value")
  plt.ylabel("Frequency")
  
  plt.show()
  </code></pre>
  
  <p>Now, it shows count of unique values at histogram. However, I can't find a way for this with bar chart. </p>
  
  <p>Full Code:</p>
  
  <pre><code>from pymongo import MongoClient
  import matplotlib.pyplot as plt
  
  def main():
  
  client = MongoClient('mongodb://a12345:a12345@127.0.0.1:27017/')
  db = client['newDatabase']
  collection = db['jobs']
  cursor = collection.find({}, {'_constructed': 1})
  
  months = []
  for document in cursor:
      if '_constructed' in document: 
          months.append(document['_constructed'].month)
  
  print(months);
  plt.bar(months, range(1, 13))
  plt.title("Job Request per month")
  plt.xlabel("Value")
  plt.ylabel("Frequency")
  
  plt.show()
  
  if __name__ == "__main__":
      main()
  </code></pre>