title: Python matplotlib how to add total value on top of stacked bar chart
body: <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import numpy as np
  
  colors = dict()
  colors['sats'] = 'b'
  colors['cache'] = 'orange'
  colors['3h'] = 'k'
  colors['memory'] = 'g'
  colors['integer'] = 'r'
  #####################################
  sz = np.array([ 2.,  4.,  6.,  8.])
  
  
  t1 = np.array([  5.9718688 ,  13.23303584,  23.9000157 ,  37.94884449])
  t2 = np.array([  7.38123836,  16.45442501,  29.56201748,  46.60925727])
  t3 = np.array([   8.87223103,   19.89443438,   36.27273578,   57.65372517])
  t4 = np.array([   9.88902238,   22.11467593,   40.2324561 ,   63.90151877])
  t4 -= t3
  t3 -= t2
  t2 -= t1
  plt.bar(sz, t1, color=colors['sats'], edgecolor='white', label=&quot;SATS&quot;)
  plt.bar(sz, t2, bottom=np.array(t1), color=colors['cache'], edgecolor='white', label=&quot;Caching values&quot;)
  plt.bar(sz, t3, bottom=np.array(t1)+np.array(t2), color=colors['memory'], edgecolor='white', label=&quot;Optimizing memory access&quot;)
  plt.bar(sz, t4, bottom=np.array(t1)+np.array(t2)+np.array(t3), color=colors['integer'], edgecolor='white', label=&quot;Integer SATS&quot;)
  plt.ylim(top=70)
  plt.xlabel('Filter radius')
  plt.ylabel('Cumulative speedup ratio')
  plt.legend()
  plt.savefig(&quot;benchmark-cpu-relativit.pdf&quot;, transparent = True, bbox_inches = 'tight', pad_inches = 0)
  plt.close()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/LCj1e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LCj1e.png" alt="Add text on top of all bars" /></a></p>
  <p>So I want to add the total value on top of the bars. For example, first bar should have 10, second bar should have 22, ...</p>
  <p>I tried <code>barh</code> but I get error <code>TypeError: bar() got multiple values for keyword argument 'bottom'</code></p>