Browse Source

BUG: Correct KeyError from matplotlib when processing Series yerr

closes #11858

Author: Gábor Lipták <gliptak@gmail.com>

Closes #13114 from gliptak/yerr1 and squashes the following commits:

926329a [Gábor Lipták] Correct KeyError from matplotlib when processing Series xerr/yerr
pull/13114/merge
Gábor Lipták 6 years ago committed by Jeff Reback
parent
commit
e5c18b4383
  1. 4
      codecov.yml
  2. 2
      doc/source/whatsnew/v0.18.2.txt
  3. 4
      pandas/tools/plotting.py
  4. 7
      pandas/tseries/tests/test_plotting.py

4
codecov.yml

@ -7,7 +7,3 @@ coverage:
default:
target: '50'
branches: null
changes:
default:
branches:
- master

2
doc/source/whatsnew/v0.18.2.txt

@ -33,7 +33,6 @@ Other enhancements
.. _whatsnew_0182.api:
API changes
@ -108,6 +107,7 @@ Performance Improvements
Bug Fixes
~~~~~~~~~
- Bug in ``SparseDataFrame`` in which ``axis=None`` did not default to ``axis=0`` (:issue:`13048`)
- Bug when passing a not-default-indexed ``Series`` as ``xerr`` or ``yerr`` in ``.plot()`` (:issue:`11858`)

4
pandas/tools/plotting.py

@ -1331,6 +1331,10 @@ class MPLPlot(object):
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

7
pandas/tseries/tests/test_plotting.py

@ -76,6 +76,13 @@ class TestTSPlot(tm.TestCase):
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

Loading…
Cancel
Save