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

Appearance settings

Commit 6fa35aa

Browse filesBrowse files
committed
Merge pull request #1445 from jrevans/working
JRE - Modified 'use' so that it will only warn if the requested backend is different that what is currently set.
2 parents c63f671 + 6ccdbbc commit 6fa35aa
Copy full SHA for 6fa35aa

File tree

Expand file treeCollapse file tree

1 file changed

+11
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-9
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,18 @@ def use(arg, warn=True, force=False):
999999
:func:`matplotlib.get_backend`.
10001000
10011001
"""
1002+
# Lets determine the proper backend name first
1003+
if arg.startswith('module://'):
1004+
name = arg
1005+
else:
1006+
# Lowercase only non-module backend names (modules are case-sensitive)
1007+
arg = arg.lower()
1008+
name = validate_backend(arg)
1009+
10021010
# Check if we've already set up a backend
10031011
if 'matplotlib.backends' in sys.modules:
1004-
if warn:
1012+
# Warn only if called with a different name
1013+
if (rcParams['backend'] != name) and warn:
10051014
warnings.warn(_use_error_msg)
10061015

10071016
# Unless we've been told to force it, just return
@@ -1011,14 +1020,7 @@ def use(arg, warn=True, force=False):
10111020
else:
10121021
need_reload = False
10131022

1014-
# Set-up the proper backend name
1015-
if arg.startswith('module://'):
1016-
name = arg
1017-
else:
1018-
# Lowercase only non-module backend names (modules are case-sensitive)
1019-
arg = arg.lower()
1020-
name = validate_backend(arg)
1021-
1023+
# Store the backend name
10221024
rcParams['backend'] = name
10231025

10241026
# If needed we reload here because a lot of setup code is triggered on

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.