code: def draw_compare_hist(f, arg, data, bins=100, bound=None, ax=None, weights=None,
                        normed=False, use_w2=False, parts=False, grid=True):
      
      from matplotlib import pyplot as plt
  
      ax = plt.gca() if ax is None else ax
      bound = minmax(data) if bound is None else bound
      h, e = np.histogram(data, bins=bins, range=bound, weights=weights)
      err = None
      if weights is not None and use_w2:
          err, _ = np.histogram(data, bins=bins, range=bound,
                                weights=weights * weights)
          err = np.sqrt(err)
      else:
          err = np.sqrt(h)
      return draw_compare(f, arg, e, h, err, ax=ax, grid=grid, normed=normed, parts=parts)
docs: draw histogram of data with poisson error bar and f(x,*arg).
  
      ::
  
          data = np.random.rand(10000)
          f = gaussian
          draw_compare_hist(f, {'mean':0,'sigma':1}, data, normed=True)
  
      **Arguments**
  
          - **f**
          - **arg** argument pass to f. Can be dictionary or list.
          - **data** data array
          - **bins** number of bins. Default 100.
          - **bound** optional boundary of plot in tuple form. If `None` is
            given, the bound is determined from min and max of the data. Default
            `None`
          - **weights** weights array. Default None.
          - **normed** optional normalized data flag. Default False.
          - **use_w2** scaled error down to the original statistics instead of
            weighted statistics.
          - **parts** draw parts of pdf. (Works with AddPdf and Add2PdfNorm).
            Default False.