8000 Suppress some more rc deprecation warnings. · matplotlib/matplotlib@0805c57 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit 0805c57

Browse files
committed
Suppress some more rc deprecation warnings.
1 parent 99db86c commit 0805c57

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

lib/matplotlib/__init__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,21 +1243,33 @@ def rcdefaults():
12431243
Use a specific style file. Call ``style.use('default')`` to restore
12441244
the default style.
12451245
"""
1246-
rcParams.clear()
1247-
rcParams.update(rcParamsDefault)
1246+
# Deprecation warnings were already handled when creating rcParamsDefault,
1247+
# no need to reemit them here.
1248+
with warnings.catch_warnings():
1249+
warnings.simplefilter("ignore", mplDeprecation)
1250+
rcParams.clear()
1251+
rcParams.update(rcParamsDefault)
12481252

12491253

12501254
def rc_file_defaults():
12511255
"""Restore the rc params from the original rc file loaded by Matplotlib.
12521256
"""
1253-
rcParams.update(rcParamsOrig)
1257+
# Deprecation warnings were already handled when creating rcParamsOrig, no
1258+
# need to reemit them here.
1259+
with warnings.catch_warnings():
1260+
warnings.simplefilter("ignore", mplDeprecation)
1261+
rcParams.update(rcParamsOrig)
12541262

12551263

12561264
def rc_file(fname):
12571265
"""
12581266
Update rc params from file.
12591267
"""
1260-
rcParams.update(rc_params_from_file(fname))
1268+
# Deprecation warnings were already handled in rc_params_from_file, no need
1269+
# to reemit them here.
1270+
with warnings.catch_warnings():
1271+
warnings.simplefilter("ignore", mplDeprecation)
1272+
rcParams.update(rc_params_from_file(fname))
12611273

12621274

12631275
class rc_context:

lib/matplotlib/style/core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import matplotlib as mpl
2020
from matplotlib import rc_params_from_file, rcParamsDefault
21+
from matplotlib.cbook import MatplotlibDeprecationWarning
2122

2223

2324
__all__ = ['use', 'context', 'available', 'library', 'reload_library']
@@ -98,7 +99,11 @@ def use(style):
9899
if not isinstance(style, str):
99100
_apply_style(style)
100101
elif style == 'default':
101-
_apply_style(rcParamsDefault, warn=False)
102+
# Deprecation warnings were already handled when creating
103+
# rcParamsDefault, no need to reemit them here.
104+
with warnings.catch_warnings():
105+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
106+
_apply_style(rcParamsDefault, warn=False)
102107
elif style in library:
103108
_apply_style(library[style])
104109
else:

0 commit comments

Comments
 (0)
0