Skip to content

Commit b494748

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

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

doc/source/whatsnew/v3.0.0.rst

+14
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Other enhancements
3939
- :meth:`Styler.format_index_names` can now be used to format the index and column names (:issue:`48936` and :issue:`47489`)
4040
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
4141
- :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`)
42+
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
4243

4344
.. ---------------------------------------------------------------------------
4445
.. _whatsnew_300.notable_bug_fixes:
@@ -341,6 +342,19 @@ Performance improvements
341342

342343
Bug fixes
343344
~~~~~~~~~
345+
- Fixed bug in :class:`SparseDtype` for equal comparison with na fill value. (:issue:`54770`)
346+
- Fixed bug in :meth:`.DataFrameGroupBy.median` where nat values gave an incorrect result. (:issue:`57926`)
347+
- Fixed bug in :meth:`DataFrame.cumsum` which was raising ``IndexError`` if dtype is ``timedelta64[ns]`` (:issue:`57956`)
348+
- Fixed bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which caused an exception when using NumPy attributes via ``@`` notation, e.g., ``df.eval("@np.floor(a)")``. (:issue:`58041`)
349+
- Fixed bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
350+
- Fixed bug in :meth:`DataFrame.to_string` that raised ``StopIteration`` with nested DataFrames. (:issue:`16098`)
351+
- Fixed bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
352+
- Fixed bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
353+
- Fixed bug in :meth:`DataFrameGroupBy.apply` that was returning a completely empty DataFrame when all return values of ``func`` were ``None`` instead of returning an empty DataFrame with the original columns and dtypes. (:issue:`57775`)
354+
- Fixed bug in :meth:`Series.diff` allowing non-integer values for the ``periods`` argument. (:issue:`56607`)
355+
- Fixed bug in :meth:`Series.rank` that doesn't preserve missing values for nullable integers when ``na_option='keep'``. (:issue:`56976`)
356+
- Fixed bug in :meth:`Series.replace` and :meth:`DataFrame.replace` inconsistently replacing matching instances when ``regex=True`` and missing values are present. (:issue:`56599`)
357+
- Fixed bug in :meth:`read_csv` raising ``TypeError`` when ``index_col`` is specified and ``na_values`` is a dict containing the key ``None``. (:issue:`57547`)
344358

345359
Categorical
346360
^^^^^^^^^^^

pandas/plotting/_matplotlib/core.py

+1-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

@@ -2090,6 +2087,7 @@ def blank_labeler(label, value):
20902087
return label
20912088

20922089
idx = [pprint_thing(v) for v in self.data.index]
2090+
# `label` is intentionally unused but is required for unpacking the tuple
20932091
labels = kwds.pop("labels", idx)
20942092
# labels is used for each wedge's labels
20952093
# Blank out labels for values of 0 so they don't overlap

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)