MCPcopy Index your code
hub / github.com/ipython/ipython / mpl_execfile

Function mpl_execfile

IPython/core/pylabtools.py:216–246  ·  view source on GitHub ↗

matplotlib-aware wrapper around safe_execfile. Its interface is identical to that of the :func:`execfile` builtin. This is ultimately a call to execfile(), but wrapped in safeties to properly handle interactive rendering.

(fname,*where,**kw)

Source from the content-addressed store, hash-verified

214 """
215
216 def mpl_execfile(fname,*where,**kw):
217 """matplotlib-aware wrapper around safe_execfile.
218
219 Its interface is identical to that of the :func:`execfile` builtin.
220
221 This is ultimately a call to execfile(), but wrapped in safeties to
222 properly handle interactive rendering."""
223
224 import matplotlib
225 import matplotlib.pyplot as plt
226
227 # print('*** Matplotlib runner ***') # dbg
228 # turn off rendering until end of script
229 with matplotlib.rc_context({"interactive": False}):
230 safe_execfile(fname, *where, **kw)
231
232 if matplotlib.is_interactive():
233 plt.show()
234
235 # make rendering call now, if the user tried to do it
236 if plt.draw_if_interactive.called:
237 plt.draw()
238 plt.draw_if_interactive.called = False
239
240 # re-draw everything that is stale
241 try:
242 da = plt.draw_all
243 except AttributeError:
244 pass
245 else:
246 da()
247
248 return mpl_execfile
249

Callers

nothing calls this directly

Calls 1

showMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…