Skip to content

Commit

Permalink
BUG: fix log bar plot again #3309
Browse files Browse the repository at this point in the history
closes #3309
  • Loading branch information
y-p committed Apr 10, 2013
1 parent 6ec2467 commit d749b91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pandas/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,16 @@ 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)

p1 = Series([200,500]).plot(log=True,kind='bar')
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):
Expand Down
10 changes: 7 additions & 3 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit d749b91

Please sign in to comment.