Skip to content

Commit d749b91

Browse files
author
y-p
committed
BUG: fix log bar plot again #3309
closes #3309
1 parent 6ec2467 commit d749b91

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pandas/tests/test_graphics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,16 @@ def test_bar_log(self):
409409
# GH3254, GH3298 matplotlib/matplotlib#1882, #1892
410410
# regressions in 1.2.1
411411

412-
df = DataFrame({'A': [3] * 5, 'B': range(5)}, index=range(5))
412+
df = DataFrame({'A': [3] * 5, 'B': range(1,6)}, index=range(5))
413413
ax = df.plot(kind='bar', grid=True,log=True)
414414
self.assertEqual(ax.yaxis.get_ticklocs()[0],1.0)
415415

416416
p1 = Series([200,500]).plot(log=True,kind='bar')
417417
p2 = DataFrame([Series([200,300]),Series([300,500])]).plot(log=True,kind='bar',subplots=True)
418418

419419
(p1.yaxis.get_ticklocs() == np.array([ 0.625, 1.625]))
420-
(p2[0].yaxis.get_ticklocs() == np.array([ 100., 1000.])).all()
421-
(p2[1].yaxis.get_ticklocs() == np.array([ 100., 1000.])).all()
420+
(p2[0].yaxis.get_ticklocs() == np.array([ 1., 10., 100., 1000.])).all()
421+
(p2[1].yaxis.get_ticklocs() == np.array([ 1., 10., 100., 1000.])).all()
422422

423423
@slow
424424
def test_boxplot(self):

pandas/tools/plotting.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1374,9 +1374,13 @@ def _make_plot(self):
13741374
kwds = self.kwds.copy()
13751375
kwds['color'] = colors[i % len(colors)]
13761376

1377-
# default, GH3254
1378-
# I tried, I really did.
1379-
start = 0 if mpl.__version__ == "1.2.1" else None
1377+
start =0
1378+
if self.log:
1379+
start = 1
1380+
if any(y < 1):
1381+
# GH3254
1382+
start = 0 if mpl.__version__ == "1.2.1" else None
1383+
13801384
if self.subplots:
13811385
ax = self._get_ax(i) # self.axes[i]
13821386

0 commit comments

Comments
 (0)