Skip to content

Commit bb7c536

Browse files
committed
Restore some backcompat.
1 parent 387a34e commit bb7c536

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

lib/matplotlib/axes/_base.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ def __init__(self, fig, rect,
523523
self._hold = rcParams['axes.hold']
524524
self._connected = {} # a dict from events to (id, func)
525525
self.cla()
526+
# funcs used to format x and y - fall back on major formatters
527+
self.fmt_xdata = None
528+
self.fmt_ydata = None
526529

527530
self.set_cursor_props((1, 'k')) # set the cursor properties for axes
528531

@@ -3265,10 +3268,12 @@ def yaxis_date(self, tz=None):
32653268
self.yaxis.axis_date(tz)
32663269

32673270
def format_xdata(self, x):
3268-
return self.xaxis.get_major_formatter().format_for_cursor(x)
3271+
return (self.fmt_xdata(x) if self.fmt_xdata is not None
3272+
else self.xaxis.get_major_formatter().format_for_cursor(x))
32693273

32703274
def format_ydata(self, y):
3271-
return self.yaxis.get_major_formatter().format_for_cursor(y)
3275+
return (self.fmt_ydata(y) if self.fmt_ydata is not None
3276+
else self.yaxis.get_major_formatter().format_for_cursor(y))
32723277

32733278
def format_coord(self, x, y):
32743279
"""Return a format string formatting the *x*, *y* coord"""

lib/matplotlib/ticker.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -319,18 +319,14 @@ class ScalarFormatter(Formatter):
319319
axes.formatter.limits rc parameter.
320320
"""
321321

322-
def __init__(self, *args, **kwargs):
323-
# Keyword-only arguments.
324-
use_offset = kwargs.pop("use_offset", None)
325-
use_mathtext = kwargs.pop("use_mathtext", None)
326-
use_locale = kwargs.pop("use_locale", None)
327-
super(ScalarFormatter, self).__init__(*args, **kwargs)
328-
self._use_offset = (use_offset if use_offset is not None
322+
def __init__(self, useOffset=None, useMathText=None, useLocale=None):
323+
super(ScalarFormatter, self).__init__()
324+
self._use_offset = (useOffset if useOffset is not None
329325
else rcParams["axes.formatter.useoffset"])
330326
self._usetex = rcParams["text.usetex"]
331-
self._use_mathtext = (use_mathtext if use_mathtext is not None
327+
self._use_mathtext = (useMathText if useMathText is not None
332328
else rcParams["axes.formatter.use_mathtext"])
333-
self._use_locale = (use_locale if use_locale is not None
329+
self._use_locale = (useLocale if useLocale is not None
334330
else rcParams["axes.formatter.use_locale"])
335331
self._scientific = True
336332
self._powerlimits = rcParams['axes.formatter.limits']

0 commit comments

Comments
 (0)