code: def stem_leaf_plot(data, vmin, vmax, bins, digit=1, title=None):
      '''
      Generate stem and leaf plot given a collection of numbers
      '''
      assert bins > 0
      range = vmax - vmin
      step = range * 1. / bins
      if isinstance(range, int):
          step = int(ceil(step))
  
      step = step or 1
  
      bins = np.arange(vmin, vmax + step, step)
      hist, bin_edges = np.histogram(data, bins=bins)
      # By default, len(bin_edges) = len(hist) + 1
      bin_edges = bin_edges[:len(hist)]
      asciiplot(bin_edges, hist, digit=digit, title=title)
      print("Last bin ends in {0}, inclusive.".format(vmax), file=sys.stderr)
  
      return bin_edges, hisf stem_leaf_plot(data, vmin, vmax, bins, digit=1, title=None):
      '''
      Generate stem and leaf plot given a collection of numbers
      '''
      assert bins > 0
      range = vmax - vmin
      step = range * 1. / bins
      if isinstance(range, int):
          step = int(ceil(step))
  
      step = step or 1
  
      bins = np.arange(vmin, vmax + step, step)
      hist, bin_edges = np.histogram(data, bins=bins)
      # By default, len(bin_edges) = len(hist) + 1
      bin_edges = bin_edges[:len(hist)]
      asciiplot(bin_edges, hist, digit=digit, title=title)
      print("Last bin ends in {0}, inclusive.".format(vmax), file=sys.stderr)
  
      return bin_edges, hist
docs: Generate stem and leaf plot given a collection of numbers