##// END OF EJS Templates
Backport PR #9998: Mnt remove unneeded pylab imports...
Min RK -
Show More
@@ -161,7 +161,7 b' def mpl_runner(safe_execfile):'
161 161 properly handle interactive rendering."""
162 162
163 163 import matplotlib
164 import matplotlib.pylab as pylab
164 import matplotlib.pyplot as plt
165 165
166 166 #print '*** Matplotlib runner ***' # dbg
167 167 # turn off rendering until end of script
@@ -170,9 +170,17 b' def mpl_runner(safe_execfile):'
170 170 safe_execfile(fname,*where,**kw)
171 171 matplotlib.interactive(is_interactive)
172 172 # make rendering call now, if the user tried to do it
173 if pylab.draw_if_interactive.called:
174 pylab.draw()
175 pylab.draw_if_interactive.called = False
173 if plt.draw_if_interactive.called:
174 plt.draw()
175 plt.draw_if_interactive.called = False
176
177 # re-draw everything that is stale
178 try:
179 da = plt.draw_all
180 except AttributeError:
181 pass
182 else:
183 da()
176 184
177 185 return mpl_execfile
178 186
@@ -298,12 +306,12 b' def activate_matplotlib(backend):'
298 306
299 307 # This must be imported last in the matplotlib series, after
300 308 # backend/interactivity choices have been made
301 import matplotlib.pylab as pylab
309 import matplotlib.pyplot as plt
302 310
303 pylab.show._needmain = False
311 plt.show._needmain = False
304 312 # We need to detect at runtime whether show() is called by the user.
305 313 # For this, we wrap it into a decorator which adds a 'called' flag.
306 pylab.draw_if_interactive = flag_calls(pylab.draw_if_interactive)
314 plt.draw_if_interactive = flag_calls(plt.draw_if_interactive)
307 315
308 316
309 317 def import_pylab(user_ns, import_all=True):
General Comments 0
You need to be logged in to leave comments. Login now