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 faeebe6

Browse filesBrowse files
committed
Simplify backend switching in plot_directive.
We can always switch to Agg now.
1 parent a2a41be commit faeebe6
Copy full SHA for faeebe6

File tree

Expand file treeCollapse file tree

1 file changed

+3
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-10
lines changed

‎lib/matplotlib/sphinxext/plot_directive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/sphinxext/plot_directive.py
+3-10Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,17 @@
146146
import sys
147147
import textwrap
148148
import traceback
149-
import warnings
150149

151150
from docutils.parsers.rst import directives, Directive
152151
from docutils.parsers.rst.directives.images import Image
153152
import jinja2 # Sphinx dependency.
154153

155154
import matplotlib
156155
from matplotlib.backend_bases import FigureManagerBase
157-
try:
158-
with warnings.catch_warnings(record=True):
159-
warnings.simplefilter("error", UserWarning)
160-
matplotlib.use('Agg')
161-
except UserWarning:
162-
import matplotlib.pyplot as plt
163-
plt.switch_backend("Agg")
164-
else:
165-
import matplotlib.pyplot as plt
156+
import matplotlib.pyplot as plt
166157
from matplotlib import _pylab_helpers, cbook
158+
159+
matplotlib.use("agg")
167160
align = Image.align
168161

169162
__version__ = 2

0 commit comments

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