From eb5950bc7ee95591c1d2491a02b269580b3828b4 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Mon, 20 Mar 2017 15:48:54 -0600 Subject: [PATCH] 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. --- lib/matplotlib/tests/test_ticker.py | 32 ++++++++++++++--------------- lib/matplotlib/ticker.py | 11 +--------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py index 30f3caead0bb..3a8a4a321c8c 100644 --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -321,24 +321,24 @@ def get_view_interval(self): def test_LogFormatterSciNotation(): test_cases = { 10: ( - (-1, '${-10^{0}}$'), - (1e-05, '${10^{-5}}$'), - (1, '${10^{0}}$'), - (100000, '${10^{5}}$'), - (2e-05, '${2\\times10^{-5}}$'), - (2, '${2\\times10^{0}}$'), - (200000, '${2\\times10^{5}}$'), - (5e-05, '${5\\times10^{-5}}$'), - (5, '${5\\times10^{0}}$'), - (500000, '${5\\times10^{5}}$'), + (-1, '$\\mathdefault{-10^{0}}$'), + (1e-05, '$\\mathdefault{10^{-5}}$'), + (1, '$\\mathdefault{10^{0}}$'), + (100000, '$\\mathdefault{10^{5}}$'), + (2e-05, '$\\mathdefault{2\\times10^{-5}}$'), + (2, '$\\mathdefault{2\\times10^{0}}$'), + (200000, '$\\mathdefault{2\\times10^{5}}$'), + (5e-05, '$\\mathdefault{5\\times10^{-5}}$'), + (5, '$\\mathdefault{5\\times10^{0}}$'), + (500000, '$\\mathdefault{5\\times10^{5}}$'), ), 2: ( - (0.03125, '${2^{-5}}$'), - (1, '${2^{0}}$'), - (32, '${2^{5}}$'), - (0.0375, '${1.2\\times2^{-5}}$'), - (1.2, '${1.2\\times2^{0}}$'), - (38.4, '${1.2\\times2^{5}}$'), + (0.03125, '$\\mathdefault{2^{-5}}$'), + (1, '$\\mathdefault{2^{0}}$'), + (32, '$\\mathdefault{2^{5}}$'), + (0.0375, '$\\mathdefault{1.2\\times2^{-5}}$'), + (1.2, '$\\mathdefault{1.2\\times2^{0}}$'), + (38.4, '$\\mathdefault{1.2\\times2^{5}}$'), ) } diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 1fc3de76d8bc..b798037de52d 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -197,16 +197,7 @@ def _divmod(x, y): def _mathdefault(s): - """ - For backward compatibility, in classic mode we display - sub/superscripted text in a mathdefault block. As of 2.0, the - math font already matches the default font, so we don't need to do - that anymore. - """ - if rcParams['_internal.classic_mode']: - return '\\mathdefault{%s}' % s - else: - return '{%s}' % s + return '\\mathdefault{%s}' % s class _DummyAxis(object):