Skip to content

BUG: DataFrame.hist() does not get along with matplotlib.pyplot.tight_layout() #15602

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

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ Bug Fixes
- Bug in ``.read_csv()`` with ``parse_dates`` when multiline headers are specified (:issue:`15376`)
- Bug in ``groupby.transform()`` that would coerce the resultant dtypes back to the original (:issue:`10972`, :issue:`11444`)

- Bug in ``DataFrame.hist`` where ``plt.tight_layout`` caused an ``AttributeError`` (use ``matplotlib >= 0.2.0``) (:issue:`9351`)
- Bug in ``DataFrame.hist`` where ``plt.tight_layout`` caused an ``AttributeError`` (:issue:`9351`)
- Bug in ``DataFrame.boxplot`` where ``fontsize`` was not applied to the tick labels on both axes (:issue:`15108`)
- Bug in ``Series.replace`` and ``DataFrame.replace`` which failed on empty replacement dicts (:issue:`15289`)
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
Expand Down
9 changes: 4 additions & 5 deletions pandas/tests/plotting/test_hist_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,11 @@ 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))
_check_plot_works(df.hist)
self.plt.tight_layout()
df = DataFrame(randn(100, 3))
_check_plot_works(df.hist)
self.plt.tight_layout()

tm.close()
tm.close()


@tm.mplskip
Expand Down
2 changes: 1 addition & 1 deletion pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3457,7 +3457,7 @@ def _subplots(naxes=None, sharex=False, sharey=False, squeeze=True,

if naxes != nplots:
for ax in axarr[naxes:]:
ax.set_visible(False)
ax.axis('off')

_handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey)

Expand Down