Skip to content

Commit 62645c0

Browse files
committed
Conver to Series at the end
1 parent f624b64 commit 62645c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/plotting/_matplotlib/boxplot.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ def maybe_color_bp(self, bp) -> None:
190190

191191
def _make_plot(self, fig: Figure) -> None:
192192
if self.subplots:
193-
self._return_obj = pd.Series(dtype=object)
193+
axes = []
194+
labels = []
194195

195196
# Re-create iterated data if `by` is assigned by users
196197
data = (
@@ -221,10 +222,12 @@ def _make_plot(self, fig: Figure) -> None:
221222
ax, y, column_num=i, return_type=self.return_type, **kwds
222223
)
223224
self.maybe_color_bp(bp)
224-
self._return_obj[label] = ret
225+
axes.append(ret)
226+
labels.append(label)
225227
_set_ticklabels(
226228
ax=ax, labels=ticklabels, is_vertical=self.orientation == "vertical"
227229
)
230+
self._return_obj = pd.Series(axes, index=labels, dtype=object)
228231
else:
229232
y = self.data.values.T
230233
ax = self._get_ax(0)

0 commit comments

Comments
 (0)