docs: def normalised_autocorrelation_function(chain, index=0, burn=None, 
      limit=None, fig=None, figsize=None):
      """
      Plot the autocorrelation function for each parameter of a sampler chain.
  
      :param chain:
          The sampled parameter values.
  
      :type chain:
          :class:`numpy.ndarray`
  
      :param index: [optional]
          Index to calculate the autocorrelation from.
  
      :type index:
          int
  
      :param limit: [optional]
          Maximum number of MCMC steps to display. By default half of the chain
          will be shown.
  
      :type limit:
          int
  
      :param fig: [optional]
          Figure class to use.
  
      :type fig:
          :class:`matplotlib.Figure` or None
  
      :param figsize: [optional]
          The figure size (x-dimension, y-dimension) in inches.
  
      :type figsize:
          tuple or None
      """
  
      factor = 2.0
      lbdim = 0.2 * factor
      trdim = 0.2 * factor
      whspace = 0.10
      dimy = lbdim + factor + trdim
      dimx = lbdim + factor + trdim
  
      if fig is None:
          fig, ax = plt.subplots(figsize=figsize)
      else:
          ax = fig.axes[0]
  
      lm = lbdim / dimx
      bm = lbdim / dimy
      trm = (lbdim + factor) / dimy
      fig.subplots_adjust(left=lm, bottom=bm, right=trm, top=trm,
          wspace=whspace, hspace=whspace)
  
      # Calculate the autocorrelation function for each parameter
      num_parameters = chain.shape[2]
      for i in xrange(num_parameters):
          try:
              rho = emcee.autocorr.function(np.mean(chain[:, index:, i], axis=0))
          except RuntimeError:
              logger.exception("Error in calculating auto-correlation function "\
                  "for parameter index {}".format(i))
          else:
              ax.plot(rho, "k", lw=1)
  
      if burn:
          ax.axvline(burn, linestyle=":", color="k")
  
      ax.xaxis.set_major_locator(MaxNLocator(5))
      [l.set_rotation(45) for l in ax.get_xticklabels()]
      
      ax.set_yticks([-0.5, 0, 0.5, 1.0])
      [l.set_rotation(45) for l in ax.get_yticklabels()]
  
      ax.axhline(0, color="k")
      ax.set_xlim(0, limit if limit is not None else chain.shape[1] - index)
      ax.set_xlabel("$\\tau$")
      ax.set_ylabel("Auto-correlation")
  
      fig.tight_layout()
  
      return fig