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: Series.plot(kind="pie") does not respect ylabel argument #58254

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Expand Up @@ -42,6 +42,7 @@ Other enhancements
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
- :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`)
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)

.. ---------------------------------------------------------------------------
.. _whatsnew_300.notable_bug_fixes:
Expand Down
3 changes: 0 additions & 3 deletions pandas/plotting/_matplotlib/core.py
Expand Up @@ -2077,9 +2077,6 @@ def _make_plot(self, fig: Figure) -> None:

for i, (label, y) in enumerate(self._iter_data(data=self.data)):
ax = self._get_ax(i)
if label is not None:
label = pprint_thing(label)
ax.set_ylabel(label)

kwds = self.kwds.copy()

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/plotting/frame/test_frame.py
Expand Up @@ -1629,7 +1629,7 @@ def test_pie_df_subplots(self):
for ax in axes:
_check_text_labels(ax.texts, df.index)
for ax, ylabel in zip(axes, df.columns):
assert ax.get_ylabel() == ylabel
assert ax.get_ylabel() == ""

def test_pie_df_labels_colors(self):
df = DataFrame(
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/plotting/test_series.py
Expand Up @@ -378,7 +378,7 @@ def test_pie_series(self):
)
ax = _check_plot_works(series.plot.pie)
_check_text_labels(ax.texts, series.index)
assert ax.get_ylabel() == "YLABEL"
assert ax.get_ylabel() == ""

def test_pie_series_no_label(self):
series = Series(
Expand Down