code: def autocorrplot(trace, vars=None, fontmap = None, max_lag=100):
      
  
      try:
          # MultiTrace
          traces = trace.traces
  
      except AttributeError:
  
          # NpTrace
          traces = [trace]
  
      if fontmap is None: fontmap = {1:10, 2:8, 3:6, 4:5, 5:4}
  
      if vars is None:
          vars = traces[0].varnames
  
      # Extract sample data
      samples = [{v:trace[v] for v in vars} for trace in traces]
  
      chains = len(traces)
  
      n = len(samples[0])
      f, ax = subplots(n, chains, squeeze=False)
  
      max_lag = min(len(samples[0][vars[0]])-1, max_lag)
  
      for i, v in enumerate(vars):
  
          for j in xrange(chains):
  
              d = np.squeeze(samples[j][v])
  
              ax[i,j].acorr(d, detrend=mlab.detrend_mean, maxlags=max_lag)
  
              if not j:
                  ax[i, j].set_ylabel("correlation")
              ax[i, j].set_xlabel("lag")
  
              if chains > 1:
                  ax[i, j].set_title("chain {0}".format(j+1))
  
      # Smaller tick labels
      tlabels = gca().get_xticklabels()
      setp(tlabels, 'fontsize', fontmap[1])
  
      tlabels = gca().get_yticklabels()
      setp(tlabels, 'fontsize', fontmap[1])
docs: Bar plot of the autocorrelation function for a trace