title: Find the x value corresponding to a histogram max
body: <p>I re-worded this to confirm to the idea of S.O. (thanks  Michael0x2a)</p>
  
  <p>I have been trying to find the x value associated with the maximum of a histogram plotted in <code>matplotlib.pyplot</code>. At first I had trouble even finding out how to access the data of the histogram just using the code</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  # Dealing with sub figures...
  fig = plt.figure()
  ax = fig.add_subplot(111)
  ax.hist(&lt;your data&gt;, bins=&lt;num of bins&gt;, normed=True, fc='k', alpha=0.3)
  
  plt.show()
  </code></pre>
  
  <p>Then after doing some reading online (and around these forums) I found that you can 'extract' the histogram data like so:</p>
  
  <pre><code>n, bins, patches = ax.hist(&lt;your data&gt;, bins=&lt;num of bins&gt;, normed=True, fc='k', alpha=0.3)
  </code></pre>
  
  <p>Basically I need to know how to find the value of <code>bins</code> that the maximum <code>n</code> corresponds to! </p>
  
  <p>Cheers!</p>