Skip to content

Commit ecf4154

Browse files
committed
Rename it all
1 parent 77f76d2 commit ecf4154

File tree

7 files changed

+193
-183
lines changed

7 files changed

+193
-183
lines changed

doc/source/options.rst

Lines changed: 160 additions & 160 deletions
Large diffs are not rendered by default.

doc/source/whatsnew/v0.21.1.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ the converter.
2020

2121
.. code-block:: python
2222

23-
>>> from pandas.plotting import register_converters
24-
>>> register_converters()
23+
>>> from pandas.plotting import register_matplotlib_converters
24+
>>> register_matplotlib_converters()
2525

2626
This caused problems for some users, so we're temporarily reverting that change;
2727
pandas will again register the converters on import. Using the converters
@@ -39,16 +39,16 @@ without explicitly registering them will cause a ``FutureWarning``:
3939
converters.
4040

4141
To register the converters:
42-
>>> from pandas.plotting import register_converters
43-
>>> register_converters()
42+
>>> from pandas.plotting import register_matplotlib_converters
43+
>>> register_matplotlib_converters()
4444

4545
As the error message says, you'll need to register the converters if you intend
4646
to use them with matplotlib plotting functions. Pandas plotting functions, such
4747
as ``Series.plot``, will register them for you; calling ``register_converters``
4848
first is not necessary.
4949

5050
We've added a new option to control the converters,
51-
``pd.options.plotting.mpl.converters``. By default, they are
51+
``pd.options.plotting.matplotlib.register_converters``. By default, they are
5252
registered. Toggling this to ``False`` removes pandas' formatters (:issue:`18301`)
5353

5454
We're working with the matplotlib developers to make this easier. We're trying

pandas/core/config_init.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,14 +494,15 @@ def use_inf_as_na_cb(key):
494494

495495

496496
def register_converter_cb(key):
497-
from pandas.plotting import register_converters, deregister_converters
497+
from pandas.plotting import register_matplotlib_converters
498+
from pandas.plotting import deregister_matplotlib_converters
498499

499500
if cf.get_option(key):
500-
register_converters()
501+
register_matplotlib_converters()
501502
else:
502-
deregister_converters()
503+
deregister_matplotlib_converters()
503504

504505

505-
with cf.config_prefix("plotting.mpl"):
506-
cf.register_option("converters", True, register_converter_doc,
506+
with cf.config_prefix("plotting.matplotlib"):
507+
cf.register_option("register_converters", True, register_converter_doc,
507508
validator=bool, cb=register_converter_cb)

pandas/plotting/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
from pandas.plotting._style import plot_params
1313
from pandas.plotting._tools import table
1414
try:
15-
from pandas.plotting._converter import register as register_converters
16-
from pandas.plotting._converter import deregister as deregister_converters
15+
from pandas.plotting._converter import \
16+
register as register_matplotlib_converters
17+
from pandas.plotting._converter import \
18+
deregister as deregister_matplotlib_converters
1719
except ImportError:
1820
pass

pandas/plotting/_converter.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ def register(warn=False):
7676
7777
See Also
7878
--------
79-
deregister
79+
deregister_matplotlib_converter
8080
"""
81+
# Renamed in pandas.plotting.__init__
8182
global _WARN
8283

8384
if not warn:
@@ -103,8 +104,9 @@ def deregister():
103104
104105
See Also
105106
--------
106-
register
107+
deregister_matplotlib_converters
107108
"""
109+
# Renamed in pandas.plotting.__init__
108110
for type_, cls in get_pairs():
109111
# We use type to catch our classes directly, no inheritance
110112
if type(units.registry.get(type_)) is cls:
@@ -127,8 +129,9 @@ def _check_implicitly_registered():
127129
"by pandas on import. Future versions of pandas will require "
128130
"you to explicitly register matplotlib converters.\n\n"
129131
"To register the converters:\n\t"
130-
">>> from pandas.plotting import register_converters\n\t"
131-
">>> register_converters()")
132+
">>> from pandas.plotting import register_matplotlib_converters"
133+
"\n\t"
134+
">>> register_matplotlib_converters()")
132135
warnings.warn(msg, FutureWarning)
133136
_WARN = False
134137

pandas/plotting/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
except ImportError:
4747
pass
4848
else:
49-
if get_option('plotting.mpl.converters'):
49+
if get_option('plotting.matplotlib.register_converters'):
5050
_converter.register(warn=True)
5151

5252

pandas/tests/plotting/test_converter.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from pandas.compat.numpy import np_datetime64_compat
1111

1212
converter = pytest.importorskip('pandas.plotting._converter')
13+
from pandas.plotting import (register_matplotlib_converters,
14+
deregister_matplotlib_converters)
1315

1416

1517
def test_timtetonum_accepts_unicode():
@@ -40,7 +42,7 @@ def test_registering_no_warning(self):
4042

4143
# Set to the "warn" state, in case this isn't the first test run
4244
converter._WARN = True
43-
converter.register()
45+
register_matplotlib_converters()
4446
with tm.assert_produces_warning(None) as w:
4547
ax.plot(s.index, s.values)
4648

@@ -60,15 +62,17 @@ def test_matplotlib_formatters(self):
6062
units = pytest.importorskip("matplotlib.units")
6163
assert Timestamp in units.registry
6264

63-
ctx = cf.option_context("plotting.mpl.converters", False)
65+
ctx = cf.option_context("plotting.matplotlib.register_converters",
66+
False)
6467
with ctx:
6568
assert Timestamp not in units.registry
6669

6770
assert Timestamp in units.registry
6871

6972
def test_option_no_warning(self):
7073
pytest.importorskip("matplotlib.pyplot")
71-
ctx = cf.option_context("plotting.mpl.converters", False)
74+
ctx = cf.option_context("plotting.matplotlib.register_converters",
75+
False)
7276
plt = pytest.importorskip("matplotlib.pyplot")
7377
s = Series(range(12), index=date_range('2017', periods=12))
7478
_, ax = plt.subplots()
@@ -83,7 +87,7 @@ def test_option_no_warning(self):
8387

8488
# Now test with registering
8589
converter._WARN = True
86-
converter.register()
90+
register_matplotlib_converters()
8791
with ctx:
8892
with tm.assert_produces_warning(None) as w:
8993
ax.plot(s.index, s.values)
@@ -104,9 +108,9 @@ def test_registry_resets(self):
104108
units.registry[datetime] = date_converter
105109
units.registry[date] = date_converter
106110

107-
converter.register()
111+
register_matplotlib_converters()
108112
assert not units.registry[date] is date_converter
109-
converter.deregister()
113+
deregister_matplotlib_converters()
110114
assert units.registry[date] is date_converter
111115

112116
finally:

0 commit comments

Comments
 (0)