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 512aecb

Browse filesBrowse files
authored
Merge pull request matplotlib#14540 from anntzer/sphinxswitchbackend
Simplify backend switching in plot_directive.
2 parents 1eaf40f + faeebe6 commit 512aecb
Copy full SHA for 512aecb

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
@@ -141,24 +141,17 @@
141141
import sys
142142
import textwrap
143143
import traceback
144-
import warnings
145144

146145
from docutils.parsers.rst import directives, Directive
147146
from docutils.parsers.rst.directives.images import Image
148147
import jinja2 # Sphinx dependency.
149148

150149
import matplotlib
151150
from matplotlib.backend_bases import FigureManagerBase
152-
try:
153-
with warnings.catch_warnings(record=True):
154-
warnings.simplefilter("error", UserWarning)
155-
matplotlib.use('Agg')
156-
except UserWarning:
157-
import matplotlib.pyplot as plt
158-
plt.switch_backend("Agg")
159-
else:
160-
import matplotlib.pyplot as plt
151+
import matplotlib.pyplot as plt
161152
from matplotlib import _pylab_helpers, cbook
153+
154+
matplotlib.use("agg")
162155
align = Image.align
163156

164157
__version__ = 2

0 commit comments

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