Skip to content

TST: matplotlib 2.0 fix in log limits for barplot (GH14808) #14957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pandas/tests/plotting/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,22 @@ def test_bar_log(self):

if not self.mpl_le_1_2_1:
expected = np.hstack((1.0e-04, expected, 1.0e+01))
if self.mpl_ge_2_0_0:
expected = np.hstack((1.0e-05, expected))

ax = Series([0.1, 0.01, 0.001]).plot(log=True, kind='bar')
ymin = 0.0007943282347242822 if self.mpl_ge_2_0_0 else 0.001
ymax = 0.12589254117941673 if self.mpl_ge_2_0_0 else .10000000000000001
self.assertEqual(ax.get_ylim(), (0.001, ymax))
res = ax.get_ylim()
self.assertAlmostEqual(res[0], ymin)
self.assertAlmostEqual(res[1], ymax)
tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), expected)
tm.close()

ax = Series([0.1, 0.01, 0.001]).plot(log=True, kind='barh')
self.assertEqual(ax.get_xlim(), (0.001, ymax))
res = ax.get_xlim()
self.assertAlmostEqual(res[0], ymin)
self.assertAlmostEqual(res[1], ymax)
tm.assert_numpy_array_equal(ax.xaxis.get_ticklocs(), expected)

@slow
Expand Down