title: The meaning of 'hx,xedge = np.histogram(x,xgrid)'
body: <p>Below is a program about binomially distributed random. In this code, I don't understand the sentence <code>hx,xedge = np.histogram(x,xgrid)</code>.</p>
  
  <p>What does it do? Is histogram used to draw a bar graph?</p>
  
  <p>I make the line chart with this code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib
  matplotlib.rc('xtick', labelsize=12)
  matplotlib.rc('ytick', labelsize=12)
  #generate random number from binomial density
  # with test number of 10 and probability of event of 0.4
  x = np.random.binomial(10,0.4,size=1000)
  print(x)
  #analyze the random samples with a histogram
  xgrid = np.arange(0.5,20.5,1)
  xcenter = (xgrid[1:]+xgrid[0:len(xgrid)-1])/2.
  hx,xedge = np.histogram(x,xgrid)
  #draw the histogram
  fig = plt.figure(figsize=[10,5])
  ax = fig.add_subplot(111)
  ax.plot(xcenter,hx,'ko-')
  fig.savefig('binomrand_hist.png',bbox_inches='tight')
  </code></pre>