Skip to content

TST: fix errant tight_layout test #15671

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 3 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
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
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