BUG: scatter plot with error bars broken on master · Issue #8081 · pandas-dev/pandas (original) (raw)
%matplotlib inline
import numpy as np
import pandas as pd
np.random.seed(12345)
df = pd.DataFrame(np.random.rand(10, 5), columns=['a', 'b', 'c', 'd', 'e'])
df.plot(x='a', y='b', xerr='c', yerr='d', kind='scatter')
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-1-38e437a109be> in <module>()
4 np.random.seed(12345)
5 df = pd.DataFrame(np.random.rand(10, 5), columns=['a', 'b', 'c', 'd', 'e'])
----> 6 df.plot(x='a', y='b', xerr='c', yerr='d', kind='scatter')
/Users/shoyer/dev/pandas/pandas/tools/plotting.pyc in plot_frame(frame, x, y, subplots, sharex, sharey, use_index, figsize, grid, legend, rot, ax, style, title, xlim, ylim, logx, logy, xticks, yticks, kind, sort_columns, fontsize, secondary_y, layout, **kwds)
2223 secondary_y=secondary_y, layout=layout, **kwds)
2224
-> 2225 plot_obj.generate()
2226 plot_obj.draw()
2227 return plot_obj.result
/Users/shoyer/dev/pandas/pandas/tools/plotting.pyc in generate(self)
911 self._compute_plot_data()
912 self._setup_subplots()
--> 913 self._make_plot()
914 self._add_table()
915 self._make_legend()
/Users/shoyer/dev/pandas/pandas/tools/plotting.pyc in _make_plot(self)
1402
1403 errors_x = self._get_errorbars(label=x, index=0, yerr=False)
-> 1404 errors_y = self._get_errorbars(label=y, index=1, xerr=False)
1405 if len(errors_x) > 0 or len(errors_y) > 0:
1406 err_kwds = dict(errors_x, **errors_y)
/Users/shoyer/dev/pandas/pandas/tools/plotting.pyc in _get_errorbars(self, label, index, xerr, yerr)
1362 err = None
1363 elif index is not None and err is not None:
-> 1364 err = err[index]
1365
1366 if err is not None:
IndexError: index 1 is out of bounds for axis 0 with size 1