File tree 4 files changed +6
-18
lines changed
4 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,3 @@ def _mpl_ge_2_1_0():
73
73
return matplotlib .__version__ >= LooseVersion ('2.1' )
74
74
except ImportError :
75
75
return False
76
-
77
-
78
- def _mpl_ge_2_2_0 ():
79
- try :
80
- import matplotlib
81
- return matplotlib .__version__ > LooseVersion ('2.1' )
82
- except ImportError :
83
- return False
Original file line number Diff line number Diff line change 35
35
from pandas .core .indexes .period import Period , PeriodIndex
36
36
37
37
from pandas .plotting ._compat import _mpl_le_2_0_0
38
- from pandas .plotting ._compat import _mpl_ge_2_2_0
39
38
40
39
# constants
41
40
HOURS_PER_DAY = 24.
47
46
48
47
MUSEC_PER_DAY = 1e6 * SEC_PER_DAY
49
48
50
- _WARN = True
51
- _mpl_units = {}
49
+ _WARN = True # Global for whether pandas has registered the units explicitly
50
+ _mpl_units = {} # Cache for units overwritten by us
52
51
53
52
54
53
def get_pairs ():
@@ -60,12 +59,10 @@ def get_pairs():
60
59
(pydt .time , TimeConverter ),
61
60
(np .datetime64 , DatetimeConverter ),
62
61
]
63
- if _mpl_ge_2_2_0 ():
64
- pairs = pairs [:2 ]
65
62
return pairs
66
63
67
64
68
- def register (warn = False ):
65
+ def register (explicit = False ):
69
66
"""Register Pandas Formatters and Converters with matplotlib
70
67
71
68
This function modifies the global ``matplotlib.units.registry``
@@ -85,11 +82,10 @@ def register(warn=False):
85
82
# Renamed in pandas.plotting.__init__
86
83
global _WARN
87
84
88
- if not warn :
85
+ if explicit :
89
86
_WARN = False
90
87
91
88
pairs = get_pairs ()
92
- print (pairs )
93
89
for type_ , cls in pairs :
94
90
converter = cls ()
95
91
if type_ in units .registry :
Original file line number Diff line number Diff line change 47
47
pass
48
48
else :
49
49
if get_option ('plotting.matplotlib.register_converters' ):
50
- _converter .register (warn = True )
50
+ _converter .register (explicit = True )
51
51
52
52
53
53
def _get_standard_kind (kind ):
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ def test_registry_resets(self):
109
109
units .registry [date ] = date_converter
110
110
111
111
register_matplotlib_converters ()
112
- assert not units .registry [date ] is date_converter
112
+ assert units .registry [date ] is date_converter
113
113
deregister_matplotlib_converters ()
114
114
assert units .registry [date ] is date_converter
115
115
You can’t perform that action at this time.
0 commit comments