def autocorrelation_plot(series, ax=None, **kwds):
import matplotlib.pyplot as plt<EOL>n = len(series)<EOL>data = np.asarray(series)<EOL>if ax is None:<EOL><INDENT>ax = plt.gca(xlim=(<NUM_LIT:1>, n), ylim=(-<NUM_LIT:1.0>, <NUM_LIT:1.0>))<EOL><DEDENT>mean = np.mean(data)<EOL>c0 = np.sum((data - mean) ** <NUM_LIT:2>) / float(n)<EOL>def r(h):<EOL><INDENT>return ((data[:n - h] - mean) *<EOL>(data[h:] - mean)).sum() / float(n) / c0<EOL><DEDENT>x = np.arange(n) + <NUM_LIT:1><EOL>y = lmap(r, x)<EOL>z95 = <NUM_LIT><EOL>z99 = <NUM_LIT><EOL>ax.axhline(y=z99 / np.sqrt(n), linestyle='<STR_LIT>', color='<STR_LIT>')<EOL>ax.axhline(y=z95 / np.sqrt(n), color='<STR_LIT>')<EOL>ax.axhline(y=<NUM_LIT:0.0>, color='<STR_LIT>')<EOL>ax.axhline(y=-z95 / np.sqrt(n), color='<STR_LIT>')<EOL>ax.axhline(y=-z99 / np.sqrt(n), linestyle='<STR_LIT>', color='<STR_LIT>')<EOL>ax.set_xlabel("<STR_LIT>")<EOL>ax.set_ylabel("<STR_LIT>")<EOL>ax.plot(x, y, **kwds)<EOL>if '<STR_LIT:label>' in kwds:<EOL><INDENT>ax.legend()<EOL><DEDENT>ax.grid()<EOL>return ax<EOL>
Autocorrelation plot for time series.

Parameters:
-----------
series: Time series
ax: Matplotlib axis object, optional
kwds : keywords
    Options to pass to matplotlib plotting method

Returns:
-----------
class:`matplotlib.axis.Axes`