Fix plotting a DataFrame without 0 in the index · pandas-dev/pandas@4b04f80 (original) (raw)
`@@ -3369,6 +3369,33 @@ def _check_errorbar_color(containers, expected, has_err='has_xerr'):
`
3369
3369
`self._check_has_errorbars(ax, xerr=0, yerr=1)
`
3370
3370
`_check_errorbar_color(ax.containers, 'green', has_err='has_yerr')
`
3371
3371
``
``
3372
`+
def test_errorbar_no_zero_in_index(self):
`
``
3373
`+
a = [1,2,3]
`
``
3374
`+
s = Series(a, index=a)
`
``
3375
`+
ax = _check_plot_works(s.plot, yerr=s)
`
``
3376
`+
self._check_has_errorbars(ax, xerr=0, yerr=1)
`
``
3377
`+
ax = _check_plot_works(s.plot, xerr=s)
`
``
3378
`+
self._check_has_errorbars(ax, xerr=1, yerr=0)
`
``
3379
`+
ax = _check_plot_works(s.plot, xerr=s, yerr=s)
`
``
3380
`+
self._check_has_errorbars(ax, xerr=1, yerr=1)
`
``
3381
+
``
3382
`+
df = DataFrame(a, index=a)
`
``
3383
`+
ax = _check_plot_works(df.plot, yerr=df)
`
``
3384
`+
self._check_has_errorbars(ax, xerr=0, yerr=1)
`
``
3385
`+
ax = _check_plot_works(df.plot, xerr=df)
`
``
3386
`+
self._check_has_errorbars(ax, xerr=1, yerr=0)
`
``
3387
`+
ax = _check_plot_works(df.plot, xerr=df, yerr=df)
`
``
3388
`+
self._check_has_errorbars(ax, xerr=1, yerr=1)
`
``
3389
+
``
3390
`+
a = np.array([[4,5,6], [7,8,9]])
`
``
3391
`+
df = DataFrame(a, index=[1,2], columns=['col1', 'col2', 'col3'])
`
``
3392
`+
ax = _check_plot_works(df.plot, yerr=df)
`
``
3393
`+
self._check_has_errorbars(ax, xerr=0, yerr=3)
`
``
3394
`+
ax = _check_plot_works(df.plot, xerr=df)
`
``
3395
`+
self._check_has_errorbars(ax, xerr=3, yerr=0)
`
``
3396
`+
ax = _check_plot_works(df.plot, xerr=df, yerr=df)
`
``
3397
`+
self._check_has_errorbars(ax, xerr=3, yerr=3)
`
``
3398
+
3372
3399
`@slow
`
3373
3400
`def test_sharex_and_ax(self):
`
3374
3401
`# https://github.com/pydata/pandas/issues/9737
`