code: def quickplot(data, xmin, xmax, xlabel, title, ylabel="Counts",
                figname="plot.pdf", counts=True, print_stats=True):
      
      plt.figure(1, (6, 6))
      left, height = zip(*sorted(data.items()))
      pad = max(height) * .01
      if counts:
          for l, h in zip(left, height):
              if xmax and l > xmax:
                  break
              plt.text(l, h + pad, str(h), color="darkslategray", size=8,
                       ha="center", va="bottom", rotation=90)
      if xmax is None:
          xmax = max(left)
  
      plt.bar(left, height, align="center")
      plt.xlabel(markup(xlabel))
      plt.ylabel(markup(ylabel))
      plt.title(markup(title))
      plt.xlim((xmin - .5, xmax + .5))
  
      # Basic statistics
      messages = []
      counts_over_xmax = sum([v for k, v in data.items() if k > xmax])
      if counts_over_xmax:
          messages += ["Counts over xmax({0}): {1}".format(xmax, counts_over_xmax)]
      kk = []
      for k, v in data.items():
          kk += [k] * v
      messages += ["Total: {0}".format(np.sum(height))]
      messages += ["Maximum: {0}".format(np.max(kk))]
      messages += ["Minimum: {0}".format(np.min(kk))]
      messages += ["Average: {0:.2f}".format(np.mean(kk))]
      messages += ["Median: {0}".format(np.median(kk))]
      ax = plt.gca()
      if print_stats:
          write_messages(ax, messages)
  
      set_human_axis(ax)
      set_ticklabels_helvetica(ax)
      savefig(figname)
docs: Simple plotting function - given a dictionary of data, produce a bar plot
      with the counts shown on the plot.