Skip to content

Commit 2897590

Browse files
authored
Backport PR #65436 on branch 3.0.x (Account for privatization of matplotlib Formatter.locs attribute) (#65520)
1 parent 49894b5 commit 2897590

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pandas/plotting/_matplotlib/converter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def default_units(x, axis) -> str:
182182
# time formatter
183183
class TimeFormatter(mpl.ticker.Formatter): # pyright: ignore[reportAttributeAccessIssue]
184184
def __init__(self, locs) -> None:
185-
self.locs = locs
185+
self.set_locs(locs)
186186

187187
def __call__(self, x, pos: int | None = 0) -> str:
188188
"""
@@ -1046,7 +1046,7 @@ def __init__(
10461046
freq = to_offset(freq, is_period=True)
10471047
self.format = None
10481048
self.freq = freq
1049-
self.locs: list[Any] = [] # unused, for matplotlib compat
1049+
super().set_locs([]) # unused, for matplotlib compat
10501050
self.formatdict: dict[Any, Any] | None = None
10511051
self.isminor = minor_locator
10521052
self.isdynamic = dynamic_mode
@@ -1070,7 +1070,7 @@ def set_locs(self, locs) -> None:
10701070
# don't actually use the locs. This is just needed to work with
10711071
# matplotlib. Force to use vmin, vmax
10721072

1073-
self.locs = locs
1073+
super().set_locs(locs)
10741074

10751075
(vmin, vmax) = tuple(self.axis.get_view_interval())
10761076
if vmax < vmin:

0 commit comments

Comments
 (0)