Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb5950b

Browse files
committed
BUG: Remove mathtext default shim for ticker (Fixes #8017)
The shim was put in place because the thinking was changing the default fonts would eliminate the need. That's not the case, as that prevents other font changes from being reflected when mathtext is used.
1 parent 47eb989 commit eb5950b

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -321,24 +321,24 @@ def get_view_interval(self):
321321
def test_LogFormatterSciNotation():
322322
test_cases = {
323323
10: (
324-
(-1, '${-10^{0}}$'),
325-
(1e-05, '${10^{-5}}$'),
326-
(1, '${10^{0}}$'),
327-
(100000, '${10^{5}}$'),
328-
(2e-05, '${2\\times10^{-5}}$'),
329-
(2, '${2\\times10^{0}}$'),
330-
(200000, '${2\\times10^{5}}$'),
331-
(5e-05, '${5\\times10^{-5}}$'),
332-
(5, '${5\\times10^{0}}$'),
333-
(500000, '${5\\times10^{5}}$'),
324+
(-1, '$\\mathdefault{-10^{0}}$'),
325+
(1e-05, '$\\mathdefault{10^{-5}}$'),
326+
(1, '$\\mathdefault{10^{0}}$'),
327+
(100000, '$\\mathdefault{10^{5}}$'),
328+
(2e-05, '$\\mathdefault{2\\times10^{-5}}$'),
329+
(2, '$\\mathdefault{2\\times10^{0}}$'),
330+
(200000, '$\\mathdefault{2\\times10^{5}}$'),
331+
(5e-05, '$\\mathdefault{5\\times10^{-5}}$'),
332+
(5, '$\\mathdefault{5\\times10^{0}}$'),
333+
(500000, '$\\mathdefault{5\\times10^{5}}$'),
334334
),
335335
2: (
336-
(0.03125, '${2^{-5}}$'),
337-
(1, '${2^{0}}$'),
338-
(32, '${2^{5}}$'),
339-
(0.0375, '${1.2\\times2^{-5}}$'),
340-
(1.2, '${1.2\\times2^{0}}$'),
341-
(38.4, '${1.2\\times2^{5}}$'),
336+
(0.03125, '$\\mathdefault{2^{-5}}$'),
337+
(1, '$\\mathdefault{2^{0}}$'),
338+
(32, '$\\mathdefault{2^{5}}$'),
339+
(0.0375, '$\\mathdefault{1.2\\times2^{-5}}$'),
340+
(1.2, '$\\mathdefault{1.2\\times2^{0}}$'),
341+
(38.4, '$\\mathdefault{1.2\\times2^{5}}$'),
342342
)
343343
}
344344

lib/matplotlib/ticker.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,7 @@ def _divmod(x, y):
197197

198198

199199
def _mathdefault(s):
200-
"""
201-
For backward compatibility, in classic mode we display
202-
sub/superscripted text in a mathdefault block. As of 2.0, the
203-
math font already matches the default font, so we don't need to do
204-
that anymore.
205-
"""
206-
if rcParams['_internal.classic_mode']:
207-
return '\\mathdefault{%s}' % s
208-
else:
209-
return '{%s}' % s
200+
return '\\mathdefault{%s}' % s
210201

211202

212203
class _DummyAxis(object):

0 commit comments

Comments
 (0)