Skip to content

Commit f293d62

Browse files
TST: matplotlib 2.0 fix in log limits for barplot (GH14808) (#14957)
1 parent 6bea827 commit f293d62

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pandas/tests/plotting/test_series.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,22 @@ def test_bar_log(self):
216216

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

220222
ax = Series([0.1, 0.01, 0.001]).plot(log=True, kind='bar')
223+
ymin = 0.0007943282347242822 if self.mpl_ge_2_0_0 else 0.001
221224
ymax = 0.12589254117941673 if self.mpl_ge_2_0_0 else .10000000000000001
222-
self.assertEqual(ax.get_ylim(), (0.001, ymax))
225+
res = ax.get_ylim()
226+
self.assertAlmostEqual(res[0], ymin)
227+
self.assertAlmostEqual(res[1], ymax)
223228
tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), expected)
224229
tm.close()
225230

226231
ax = Series([0.1, 0.01, 0.001]).plot(log=True, kind='barh')
227-
self.assertEqual(ax.get_xlim(), (0.001, ymax))
232+
res = ax.get_xlim()
233+
self.assertAlmostEqual(res[0], ymin)
234+
self.assertAlmostEqual(res[1], ymax)
228235
tm.assert_numpy_array_equal(ax.xaxis.get_ticklocs(), expected)
229236

230237
@slow

0 commit comments

Comments
 (0)