Skip to content

Commit 72d0612

Browse files
abeltavaresAbel Tavares
and
Abel Tavares
authored
BUG: Series.plot(kind="pie") does not respect ylabel argument (#58254)
Co-authored-by: Abel Tavares <[email protected]>
1 parent 3efe698 commit 72d0612

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Other enhancements
4242
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
4343
- :meth:`DataFrame.fillna` and :meth:`Series.fillna` can now accept ``value=None``; for non-object dtype the corresponding NA value will be used (:issue:`57723`)
4444
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
45+
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
4546

4647
.. ---------------------------------------------------------------------------
4748
.. _whatsnew_300.notable_bug_fixes:

pandas/plotting/_matplotlib/core.py

-3
Original file line numberDiff line numberDiff line change
@@ -2077,9 +2077,6 @@ def _make_plot(self, fig: Figure) -> None:
20772077

20782078
for i, (label, y) in enumerate(self._iter_data(data=self.data)):
20792079
ax = self._get_ax(i)
2080-
if label is not None:
2081-
label = pprint_thing(label)
2082-
ax.set_ylabel(label)
20832080

20842081
kwds = self.kwds.copy()
20852082

pandas/tests/plotting/frame/test_frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ def test_pie_df_subplots(self):
16291629
for ax in axes:
16301630
_check_text_labels(ax.texts, df.index)
16311631
for ax, ylabel in zip(axes, df.columns):
1632-
assert ax.get_ylabel() == ylabel
1632+
assert ax.get_ylabel() == ""
16331633

16341634
def test_pie_df_labels_colors(self):
16351635
df = DataFrame(

pandas/tests/plotting/test_series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def test_pie_series(self):
378378
)
379379
ax = _check_plot_works(series.plot.pie)
380380
_check_text_labels(ax.texts, series.index)
381-
assert ax.get_ylabel() == "YLABEL"
381+
assert ax.get_ylabel() == ""
382382

383383
def test_pie_series_no_label(self):
384384
series = Series(

0 commit comments

Comments
 (0)