title: barplot label individual bars with their height matplotlib python
body: <p>I have a bar chart but would like to put a label above each bar which corresponds the Net Sales of each age group to make the height of each bar more obvious to the reader, any ideas?</p>
  
  <p>Code:</p>
  
  <pre><code>cd.loc[(cd.birth_year &gt;= 1996) &amp; (cd.birth_year &lt;= 1998), "Age"] = "21 &amp; Under"
  cd.loc[(cd.birth_year &gt;= 1983) &amp; (cd.birth_year &lt;= 1995), "Age"] = "22 to 34"
  cd.loc[(cd.birth_year &gt;= 1973) &amp; (cd.birth_year &lt;= 1982), "Age"] = "35 to 44"
  cd.loc[(cd.birth_year &gt;= 1963) &amp; (cd.birth_year &lt;= 1972), "Age"] = "45 to 54"
  cd.loc[(cd.birth_year &gt;= 1953) &amp; (cd.birth_year &lt;= 1962), "Age"] = "55 to 64"
  cd.loc[(cd.birth_year &gt;= 1900) &amp; (cd.birth_year &lt;= 1952), "Age"] = "65 &amp; Over"
  agedata = cd.groupby("Age").agg({"LTIME_NO_ORDERS": sum})
  
  barplot = agedata.plot(kind="bar", colormap="Set3", legend=None)
  
  # title and axis labels
  plt.title("Net Sales of Age Groups", weight="bold", fontsize=20)
  plt.ylabel("Net Sales (£)", fontsize=16)
  plt.xlabel("Age", fontsize=16)
  plt.xticks(rotation="horizontal")
  
  rects = barplot.patches
  labels = ["label1", "label2", "label3", "label4", "label5", "label6"]
  
  for rect, label in zip(rects, labels):
      height = rect.get_height()
      barplot.text(rect.get_x() + rect.get_width()/2, height+5, label, ha="center", va="bottom")
  
  plt.show()
  </code></pre>
  
  <p>Current plot:
   <a href="https://i.stack.imgur.com/2lbk3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2lbk3.png" alt="enter image description here"></a></p>
  
  <p>Thanks for any help!</p>
  
  <p>UPDATE: how do i make the labels automatically correspond to the age range sums as opposed to manually entering the label names?</p>