From d749b91c5a594cad7306936385452bed084f3aa8 Mon Sep 17 00:00:00 2001 From: y-p Date: Wed, 10 Apr 2013 10:51:04 +0300 Subject: [PATCH] BUG: fix log bar plot again #3309 closes #3309 --- pandas/tests/test_graphics.py | 6 +++--- pandas/tools/plotting.py | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py index 629ff7b3cc2ed..02735e7d0fbbd 100644 --- a/pandas/tests/test_graphics.py +++ b/pandas/tests/test_graphics.py @@ -409,7 +409,7 @@ def test_bar_log(self): # GH3254, GH3298 matplotlib/matplotlib#1882, #1892 # regressions in 1.2.1 - df = DataFrame({'A': [3] * 5, 'B': range(5)}, index=range(5)) + df = DataFrame({'A': [3] * 5, 'B': range(1,6)}, index=range(5)) ax = df.plot(kind='bar', grid=True,log=True) self.assertEqual(ax.yaxis.get_ticklocs()[0],1.0) @@ -417,8 +417,8 @@ def test_bar_log(self): p2 = DataFrame([Series([200,300]),Series([300,500])]).plot(log=True,kind='bar',subplots=True) (p1.yaxis.get_ticklocs() == np.array([ 0.625, 1.625])) - (p2[0].yaxis.get_ticklocs() == np.array([ 100., 1000.])).all() - (p2[1].yaxis.get_ticklocs() == np.array([ 100., 1000.])).all() + (p2[0].yaxis.get_ticklocs() == np.array([ 1., 10., 100., 1000.])).all() + (p2[1].yaxis.get_ticklocs() == np.array([ 1., 10., 100., 1000.])).all() @slow def test_boxplot(self): diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index f31f67284e327..1f06a013ff63c 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -1374,9 +1374,13 @@ def _make_plot(self): kwds = self.kwds.copy() kwds['color'] = colors[i % len(colors)] - # default, GH3254 - # I tried, I really did. - start = 0 if mpl.__version__ == "1.2.1" else None + start =0 + if self.log: + start = 1 + if any(y < 1): + # GH3254 + start = 0 if mpl.__version__ == "1.2.1" else None + if self.subplots: ax = self._get_ax(i) # self.axes[i]