Skip to content
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
2 changes: 1 addition & 1 deletion doc/source/v0.14.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Performance




- Bug in subplots displays ``ticklabels`` and ``labels`` in different rule (:issue:`5897`)



Expand Down
16 changes: 15 additions & 1 deletion pandas/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,12 @@ def test_plot(self):

axes = _check_plot_works(df.plot, subplots=True, title='blah')
self._check_axes_shape(axes, axes_num=3, layout=(3, 1))
for ax in axes[:2]:
self._check_visible(ax.get_xticklabels(), visible=False)
self._check_visible([ax.xaxis.get_label()], visible=False)
for ax in [axes[2]]:
self._check_visible(ax.get_xticklabels())
self._check_visible([ax.xaxis.get_label()])

_check_plot_works(df.plot, title='blah')

Expand Down Expand Up @@ -2331,8 +2337,16 @@ def test_grouped_box_layout(self):
column='height', return_type='dict')
self._check_axes_shape(self.plt.gcf().axes, axes_num=3, layout=(2, 2))

box = df.boxplot(column=['height', 'weight', 'category'], by='gender')
# GH 5897
axes = df.boxplot(column=['height', 'weight', 'category'], by='gender',
return_type='axes')
self._check_axes_shape(self.plt.gcf().axes, axes_num=3, layout=(2, 2))
for ax in [axes['height']]:
self._check_visible(ax.get_xticklabels(), visible=False)
self._check_visible([ax.xaxis.get_label()], visible=False)
for ax in [axes['weight'], axes['category']]:
self._check_visible(ax.get_xticklabels())
self._check_visible([ax.xaxis.get_label()])

box = df.groupby('classroom').boxplot(
column=['height', 'weight', 'category'], return_type='dict')
Expand Down
13 changes: 7 additions & 6 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3022,15 +3022,16 @@ def on_right(i):

if nplots > 1:
if sharex and nrows > 1:
for i, ax in enumerate(axarr):
if np.ceil(float(i + 1) / ncols) < nrows: # only last row
[label.set_visible(
False) for label in ax.get_xticklabels()]
for ax in axarr[:naxes][:-ncols]: # only bottom row
for label in ax.get_xticklabels():
label.set_visible(False)
ax.xaxis.get_label().set_visible(False)
if sharey and ncols > 1:
for i, ax in enumerate(axarr):
if (i % ncols) != 0: # only first column
[label.set_visible(
False) for label in ax.get_yticklabels()]
for label in ax.get_yticklabels():
label.set_visible(False)
ax.yaxis.get_label().set_visible(False)

if naxes != nplots:
for ax in axarr[naxes:]:
Expand Down