Skip to content

Commit fed1827

Browse files
ResidentMariojreback
authored andcommitted
TST: DataFrame.hist() does not get along with matplotlib.pyplot.tight_layout() (pandas-dev#15515)
* Add unit test for pandas-dev#9351 * Tweaks. * add _check_plot_works; rm aux method * Add whatsnew entry.
1 parent 55eccd9 commit fed1827

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

doc/source/whatsnew/v0.20.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ Bug Fixes
629629

630630
- Bug in ``.read_csv()`` with ``parse_dates`` when multiline headers are specified (:issue:`15376`)
631631

632-
632+
- Bug in ``DataFrame.hist`` where ``plt.tight_layout`` caused an ``AttributeError`` (use ``matplotlib >= 0.2.0``) (:issue:`9351`)
633633
- Bug in ``DataFrame.boxplot`` where ``fontsize`` was not applied to the tick labels on both axes (:issue:`15108`)
634634
- Bug in ``Series.replace`` and ``DataFrame.replace`` which failed on empty replacement dicts (:issue:`15289`)
635635
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)

pandas/tests/plotting/test_hist_method.py

+10
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ def test_hist_layout(self):
238238
with tm.assertRaises(ValueError):
239239
df.hist(layout=(-1, -1))
240240

241+
@slow
242+
# GH 9351
243+
def test_tight_layout(self):
244+
if self.mpl_ge_2_0_0:
245+
df = DataFrame(randn(100, 2))
246+
_check_plot_works(df.hist)
247+
self.plt.tight_layout()
248+
249+
tm.close()
250+
241251

242252
@tm.mplskip
243253
class TestDataFrameGroupByPlots(TestPlotBase):

0 commit comments

Comments
 (0)