Skip to content
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

BUG: Subplotting boxplot shows unnecessary warnings #9278

Merged
merged 1 commit into from
Jan 18, 2015
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/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