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 1d0fb05

Browse filesBrowse files
authored
Merge pull request #14284 from meeseeksmachine/auto-backport-of-pr-14279-on-v3.1.x
Backport PR #14279 on branch v3.1.x (In case fallback to Agg fails, let the exception propagate out.)
2 parents 035e19b + 0215237 commit 1d0fb05
Copy full SHA for 1d0fb05

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,21 @@ def switch_backend(newbackend):
198198
# Don't try to fallback on the cairo-based backends as they each have
199199
# an additional dependency (pycairo) over the agg-based backend, and
200200
# are of worse quality.
201-
for candidate in ["macosx", "qt5agg", "qt4agg", "gtk3agg", "tkagg",
202-
"wxagg", "agg"]:
201+
for candidate in [
202+
"macosx", "qt5agg", "qt4agg", "gtk3agg", "tkagg", "wxagg"]:
203203
try:
204204
switch_backend(candidate)
205205
except ImportError:
206206
continue
207207
else:
208208
rcParamsOrig['backend'] = candidate
209209
return
210+
else:
211+
# Switching to Agg should always succeed; if it doesn't, let the
212+
# exception propagate out.
213+
switch_backend("agg")
214+
rcParamsOrig["backend"] = "agg"
215+
return
210216

211217
backend_name = (
212218
newbackend[9:] if newbackend.startswith("module://")

0 commit comments

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