Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ API Changes
- Raise/Warn ``SettingWithCopyError`` (according to the option ``chained_assignment`` in more cases,
when detecting chained assignment, related (:issue:`5938`)
- DataFrame.head(0) returns self instead of empty frame (:issue:`5846`)
- ``autocorrelation_plot`` now accepts ``**kwargs``. (:issue:`5623`)

Experimental Features
~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ def test_autocorrelation_plot(self):
_check_plot_works(autocorrelation_plot, self.ts)
_check_plot_works(autocorrelation_plot, self.ts.values)

ax = autocorrelation_plot(self.ts, label='Test')
t = ax.get_legend().get_texts()[0].get_text()
self.assertEqual(t, 'Test')

@slow
def test_lag_plot(self):
from pandas.tools.plotting import lag_plot
Expand Down
8 changes: 6 additions & 2 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,13 +672,15 @@ def lag_plot(series, lag=1, ax=None, **kwds):
return ax


def autocorrelation_plot(series, ax=None):
def autocorrelation_plot(series, ax=None, **kwds):
"""Autocorrelation plot for time series.

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

Returns:
-----------
Expand All @@ -705,7 +707,9 @@ def r(h):
ax.axhline(y=-z99 / np.sqrt(n), linestyle='--', color='grey')
ax.set_xlabel("Lag")
ax.set_ylabel("Autocorrelation")
ax.plot(x, y)
ax.plot(x, y, **kwds)
if 'label' in kwds:
ax.legend()
ax.grid()
return ax

Expand Down