Skip to content

Commit

Permalink
BUG: Series.plot(kind="pie") does not respect ylabel argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Abel Tavares committed Apr 29, 2024
1 parent cf0014a commit 0dd3524
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
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

0 comments on commit 0dd3524

Please sign in to comment.