Skip to content

Commit fdfe66c

Browse files
authored
CLN: backport mpl warning fix to 1.1.2 (#36155)
1 parent a61f1ad commit fdfe66c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

doc/source/whatsnew/v1.1.2.rst

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Bug fixes
4646
Other
4747
~~~~~
4848
- :meth:`factorize` now supports ``na_sentinel=None`` to include NaN in the uniques of the values and remove ``dropna`` keyword which was unintentionally exposed to public facing API in 1.1 version from :meth:`factorize` (:issue:`35667`)
49+
- :meth:`DataFrame.plot` and meth:`Series.plot` raise ``UserWarning`` about usage of FixedFormatter and FixedLocator (:issue:`35684` and :issue:`35945`)
4950

5051
.. ---------------------------------------------------------------------------
5152

pandas/plotting/_matplotlib/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,8 @@ def get_label(i):
12321232
if self._need_to_set_index:
12331233
xticks = ax.get_xticks()
12341234
xticklabels = [get_label(x) for x in xticks]
1235-
ax.set_xticklabels(xticklabels)
12361235
ax.xaxis.set_major_locator(FixedLocator(xticks))
1236+
ax.set_xticklabels(xticklabels)
12371237

12381238
condition = (
12391239
not self._use_dynamic_x()

pandas/tests/plotting/test_frame.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -2796,10 +2796,12 @@ def test_table(self):
27962796
_check_plot_works(df.plot, table=True)
27972797
_check_plot_works(df.plot, table=df)
27982798

2799-
ax = df.plot()
2800-
assert len(ax.tables) == 0
2801-
plotting.table(ax, df.T)
2802-
assert len(ax.tables) == 1
2799+
# GH 35945 UserWarning
2800+
with tm.assert_produces_warning(None):
2801+
ax = df.plot()
2802+
assert len(ax.tables) == 0
2803+
plotting.table(ax, df.T)
2804+
assert len(ax.tables) == 1
28032805

28042806
def test_errorbar_scatter(self):
28052807
df = DataFrame(np.random.randn(5, 2), index=range(5), columns=["x", "y"])

0 commit comments

Comments
 (0)