Skip to content

Commit

Permalink
TST: fix errant tight_layout test (#15671)
Browse files Browse the repository at this point in the history
closes #9351
  • Loading branch information
ResidentMario authored and jorisvandenbossche committed Mar 13, 2017
1 parent 32df1e6 commit 998c801
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions pandas/tests/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def setUp(self):
self.mpl_ge_1_4_0 = plotting._mpl_ge_1_4_0()
self.mpl_ge_1_5_0 = plotting._mpl_ge_1_5_0()
self.mpl_ge_2_0_0 = plotting._mpl_ge_2_0_0()
self.mpl_ge_2_0_1 = plotting._mpl_ge_2_0_1()

if self.mpl_ge_1_4_0:
self.bp_n_objects = 7
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_hist_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ def test_hist_layout(self):
@slow
# GH 9351
def test_tight_layout(self):
if self.mpl_ge_2_0_0:
df = DataFrame(randn(100, 2))
if self.mpl_ge_2_0_1:
df = DataFrame(randn(100, 3))
_check_plot_works(df.hist)
self.plt.tight_layout()

Expand Down
8 changes: 8 additions & 0 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ def _mpl_ge_2_0_0():
return False


def _mpl_ge_2_0_1():
try:
import matplotlib
return matplotlib.__version__ >= LooseVersion('2.0.1')
except ImportError:
return False


if _mpl_ge_1_5_0():
# Compat with mp 1.5, which uses cycler.
import cycler
Expand Down

0 comments on commit 998c801

Please sign in to comment.