diff --git a/doc/source/whatsnew/v0.18.2.txt b/doc/source/whatsnew/v0.18.2.txt index 5ffbce9867121..43fe9c32e4c64 100644 --- a/doc/source/whatsnew/v0.18.2.txt +++ b/doc/source/whatsnew/v0.18.2.txt @@ -30,7 +30,7 @@ Other enhancements ^^^^^^^^^^^^^^^^^^ - The ``.tz_localize()`` method of ``DatetimeIndex`` and ``Timestamp`` has gained the ``errors`` keyword, so you can potentially coerce nonexistent timestamps to ``NaT``. The default behaviour remains to raising a ``NonExistentTimeError`` (:issue:`13057`) - +- Correct ``KeyError`` from matplotlib when processing ``Series`` ``xerr``/``yerr`` (:issue:`13114`) diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index 808c9d22c53c8..baca8045f0cc1 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -1331,6 +1331,10 @@ def _plot(cls, ax, x, y, style=None, is_errorbar=False, **kwds): x = x._mpl_repr() if is_errorbar: + if 'xerr' in kwds: + kwds['xerr'] = np.array(kwds.get('xerr')) + if 'yerr' in kwds: + kwds['yerr'] = np.array(kwds.get('yerr')) return ax.errorbar(x, y, **kwds) else: # prevent style kwarg from going to errorbar, where it is diff --git a/pandas/tseries/tests/test_plotting.py b/pandas/tseries/tests/test_plotting.py index 9fab9c0990ef0..0284df9e58933 100644 --- a/pandas/tseries/tests/test_plotting.py +++ b/pandas/tseries/tests/test_plotting.py @@ -76,6 +76,13 @@ def test_frame_inferred(self): df = DataFrame(np.random.randn(len(idx), 3), index=idx) _check_plot_works(df.plot) + def test_is_error_nozeroindex(self): + # GH11858 + i = np.array([1, 2, 3]) + a = DataFrame(i, index=i) + _check_plot_works(a.plot, xerr=a) + _check_plot_works(a.plot, yerr=a) + def test_nonnumeric_exclude(self): import matplotlib.pyplot as plt