Skip to content

Commit b8420ba

Browse files
ResidentMarioAnkurDedania
authored andcommitted
TST: fix errant tight_layout test (pandas-dev#15671)
closes pandas-dev#9351
1 parent a4c8c60 commit b8420ba

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

pandas/tests/plotting/common.py

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def setUp(self):
5353
self.mpl_ge_1_4_0 = plotting._mpl_ge_1_4_0()
5454
self.mpl_ge_1_5_0 = plotting._mpl_ge_1_5_0()
5555
self.mpl_ge_2_0_0 = plotting._mpl_ge_2_0_0()
56+
self.mpl_ge_2_0_1 = plotting._mpl_ge_2_0_1()
5657

5758
if self.mpl_ge_1_4_0:
5859
self.bp_n_objects = 7

pandas/tests/plotting/test_hist_method.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ def test_hist_layout(self):
241241
@slow
242242
# GH 9351
243243
def test_tight_layout(self):
244-
if self.mpl_ge_2_0_0:
245-
df = DataFrame(randn(100, 2))
244+
if self.mpl_ge_2_0_1:
245+
df = DataFrame(randn(100, 3))
246246
_check_plot_works(df.hist)
247247
self.plt.tight_layout()
248248

pandas/tools/plotting.py

+8
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ def _mpl_ge_2_0_0():
150150
return False
151151

152152

153+
def _mpl_ge_2_0_1():
154+
try:
155+
import matplotlib
156+
return matplotlib.__version__ >= LooseVersion('2.0.1')
157+
except ImportError:
158+
return False
159+
160+
153161
if _mpl_ge_1_5_0():
154162
# Compat with mp 1.5, which uses cycler.
155163
import cycler

0 commit comments

Comments
 (0)