Skip to content

Commit

Permalink
BUG: Subplotting boxplot shows unnecessary warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sinhrks committed Jan 18, 2015
1 parent c567701 commit 46f25e4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.16.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Bug Fixes




- Bug in boxplot, scatter and hexbin plot may show an unnecessary warning (:issue:`8877`)



Expand Down
17 changes: 8 additions & 9 deletions pandas/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,15 +1900,14 @@ def test_boxplot(self):

# different warning on py3
if not PY3:
with tm.assert_produces_warning(UserWarning):
axes = _check_plot_works(df.plot, kind='box',
subplots=True, logy=True)

self._check_axes_shape(axes, axes_num=3, layout=(1, 3))
self._check_ax_scales(axes, yaxis='log')
for ax, label in zip(axes, labels):
self._check_text_labels(ax.get_xticklabels(), [label])
self.assertEqual(len(ax.lines), self.bp_n_objects)
axes = _check_plot_works(df.plot, kind='box',
subplots=True, logy=True)

self._check_axes_shape(axes, axes_num=3, layout=(1, 3))
self._check_ax_scales(axes, yaxis='log')
for ax, label in zip(axes, labels):
self._check_text_labels(ax.get_xticklabels(), [label])
self.assertEqual(len(ax.lines), self.bp_n_objects)

axes = series.plot(kind='box', rot=40)
self._check_ticks_props(axes, xrot=40, yrot=0)
Expand Down
11 changes: 10 additions & 1 deletion pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,10 @@ def _make_plot(self):
kws['label'] = c if c_is_column else ''
self.fig.colorbar(img, **kws)

self._add_legend_handle(scatter, label)
if label is not None:
self._add_legend_handle(scatter, label)
else:
self.legend = False

errors_x = self._get_errorbars(label=x, index=0, yerr=False)
errors_y = self._get_errorbars(label=y, index=0, xerr=False)
Expand Down Expand Up @@ -1512,6 +1515,9 @@ def _make_plot(self):
img = ax.collections[0]
self.fig.colorbar(img, ax=ax)

def _make_legend(self):
pass

def _post_plot_logic(self):
ax = self.axes[0]
x, y = self.x, self.y
Expand Down Expand Up @@ -2228,6 +2234,9 @@ def _set_ticklabels(self, ax, labels):
else:
ax.set_yticklabels(labels)

def _make_legend(self):
pass

def _post_plot_logic(self):
pass

Expand Down

0 comments on commit 46f25e4

Please sign in to comment.