Skip to content

Commit 48c3abe

Browse files
author
Abel Tavares
committed
BUG: Series.plot(kind="pie") does not respect ylabel argument
1 parent 6e09e97 commit 48c3abe

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Other enhancements
3737
- Users can globally disable any ``PerformanceWarning`` by setting the option ``mode.performance_warnings`` to ``False`` (:issue:`56920`)
3838
- :meth:`Styler.format_index_names` can now be used to format the index and column names (:issue:`48936` and :issue:`47489`)
3939
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
40+
- :meth:`Series.plot` and :meth:`DataFrame.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
4041

4142
.. ---------------------------------------------------------------------------
4243
.. _whatsnew_300.notable_bug_fixes:

pandas/plotting/_matplotlib/core.py

+2
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,8 @@ def _adorn_subplots(self, fig: Figure) -> None:
784784
# ylabel will set it as ylabel in the plot.
785785
if self.ylabel is not None:
786786
ax.set_ylabel(pprint_thing(self.ylabel))
787+
else:
788+
ax.set_ylabel("")
787789

788790
ax.grid(self.grid)
789791

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)