Skip to content

Commit 04d8aa5

Browse files
committed
No warnings by default
1 parent 576d244 commit 04d8aa5

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

pandas/plotting/_compat.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,3 @@ def _mpl_ge_2_1_0():
7373
return matplotlib.__version__ >= LooseVersion('2.1')
7474
except ImportError:
7575
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

pandas/plotting/_converter.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
from pandas.core.indexes.period import Period, PeriodIndex
3636

3737
from pandas.plotting._compat import _mpl_le_2_0_0
38-
from pandas.plotting._compat import _mpl_ge_2_2_0
3938

4039
# constants
4140
HOURS_PER_DAY = 24.
@@ -47,8 +46,8 @@
4746

4847
MUSEC_PER_DAY = 1e6 * SEC_PER_DAY
4948

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
5251

5352

5453
def get_pairs():
@@ -60,12 +59,10 @@ def get_pairs():
6059
(pydt.time, TimeConverter),
6160
(np.datetime64, DatetimeConverter),
6261
]
63-
if _mpl_ge_2_2_0():
64-
pairs = pairs[:2]
6562
return pairs
6663

6764

68-
def register(warn=False):
65+
def register(explicit=False):
6966
"""Register Pandas Formatters and Converters with matplotlib
7067
7168
This function modifies the global ``matplotlib.units.registry``
@@ -85,11 +82,10 @@ def register(warn=False):
8582
# Renamed in pandas.plotting.__init__
8683
global _WARN
8784

88-
if not warn:
85+
if explicit:
8986
_WARN = False
9087

9188
pairs = get_pairs()
92-
print(pairs)
9389
for type_, cls in pairs:
9490
converter = cls()
9591
if type_ in units.registry:

pandas/plotting/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
pass
4848
else:
4949
if get_option('plotting.matplotlib.register_converters'):
50-
_converter.register(warn=True)
50+
_converter.register(explicit=True)
5151

5252

5353
def _get_standard_kind(kind):

pandas/tests/plotting/test_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_registry_resets(self):
109109
units.registry[date] = date_converter
110110

111111
register_matplotlib_converters()
112-
assert not units.registry[date] is date_converter
112+
assert units.registry[date] is date_converter
113113
deregister_matplotlib_converters()
114114
assert units.registry[date] is date_converter
115115

0 commit comments

Comments
 (0)